cloudtools / troposphere

troposphere - Python library to create AWS CloudFormation descriptions
BSD 2-Clause "Simplified" License
4.93k stars 1.45k forks source link

How to write swagger body in RestApi ? #1092

Open bluedusk opened 6 years ago

bluedusk commented 6 years ago

I'm trying to write swagger in RestApi, How should I write ymal file in a dict ? Is there any example doing this ?

class RestApi(AWSObject):
    resource_type = "AWS::ApiGateway::RestApi"

    props = {
        "ApiKeySourceType": (basestring, False),
        "BinaryMediaTypes": ([basestring], False),
        "Body": (dict, False),
        "BodyS3Location": (S3Location, False),
        "CloneFrom": (basestring, False),
        "Description": (basestring, False),
        "EndpointConfiguration": (EndpointConfiguration, False),
        "FailOnWarnings": (basestring, False),
        "MinimumCompressionSize": (positive_integer, False),
        "Name": (basestring, False),
        "Parameters": ([basestring], False),
        "Policy": (dict, False),
    }
dac456 commented 6 years ago

Using yaml.load(...) (from PyYAML) returns a dict, which you can pass as the body.

More on StackOverflow.