Hi there,
I'm creating an API using an OpenAPI spec that I'm uploading to S3 using the BodyS3Location property and "aws cloudformation package".
My resource looks like this:
rest_api = t.add_resource(RestApi(
"api",
Name= "api",
BodyS3Location= "/local/path/to/my/openapi/file"
))
Which should translate to the following CloudFormation:
api:
Properties:
BodyS3Location: /local/path/to/my/openapi/file
Name: api
Type: AWS::ApiGateway::RestApi
I'm using the "aws cloudFormation package" command to upload the file to S3. The output template should look like the following:
api:
Properties:
BodyS3Location:
Bucket: BucketName
Key: ObjectKey
Name: api
Type: AWS::ApiGateway::RestApi
The issue I'm facing is that when I create my resource with Troposphere, I get a validation error because it expects an S3Location but I'm passing a string.
BodyS3Location= "/local/path/to/my/openapi/file"
BodyS3Location is <class 'str'>, expected <class 'troposphere.apigateway.S3Location'>
I tried to make sure I wasn't misunderstanding anything so I edited the generated CloudFormation template to add the BodyS3Location: /local/path/to/my/openapi/file
and it works as expected and therefore a String should be a valid value for the BodyS3Location property.
This is the first project where I use Troposphere and maybe I'm missing something and I'd appreciate if someone can help with this.