Created
May 16, 2018 13:05
-
-
Save doapp-ryanp/a189aecf359e2cc2eb278f20cc6a3b32 to your computer and use it in GitHub Desktop.
How to get around BinaryMediaTypes CloudFormation bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ApiGatewayLambdaProxy: | |
Type : AWS::ApiGateway::RestApi | |
Properties : | |
Name : !Ref AWS::StackName | |
Description: "Single Lambda proxy" | |
# BinaryMediaTypes: - this is broken in CloudFormation on create | |
# - "application/protobuf" | |
Parameters: | |
endpointConfigurationTypes: EDGE | |
Body : | |
swagger: "2.0" | |
info: | |
version: "2018-01-23T15:50:43Z" | |
title: "Lambda Proxy" | |
basePath: "/prod" | |
schemes: | |
- "https" | |
paths: | |
"/{proxy+}": | |
options: | |
consumes: | |
- "application/json" | |
produces: | |
- "application/json" | |
responses: | |
"200": | |
description: "200 response" | |
schema: | |
$ref: "#/definitions/Empty" | |
headers: | |
Access-Control-Allow-Origin: | |
type: "string" | |
Access-Control-Allow-Methods: | |
type: "string" | |
Access-Control-Allow-Headers: | |
type: "string" | |
x-amazon-apigateway-integration: | |
responses: | |
default: | |
statusCode: "200" | |
responseParameters: | |
method.response.header.Access-Control-Allow-Methods: "'DELETE,GET,HEAD,OPTIONS,PATCH,POST,PUT'" | |
method.response.header.Access-Control-Allow-Headers: "'Content-Type,Authorization,X-Amz-Date,X-Api-Key,X-Amz-Security-Token'" | |
method.response.header.Access-Control-Allow-Origin: "'*'" | |
passthroughBehavior: "when_no_match" | |
requestTemplates: | |
application/json: "{\"statusCode\": 200}" | |
type: "mock" | |
x-amazon-apigateway-any-method: | |
produces: | |
- "application/json" | |
parameters: | |
- name: "proxy" | |
in: "path" | |
required: true | |
type: "string" | |
responses: {} | |
x-amazon-apigateway-integration: | |
uri: !Sub | |
- arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${LambdaName}:${Stage}/invocations | |
- { LambdaName: !Ref LambdaName, Stage: !Select [ "0", !Split [ '--', !Ref 'AWS::StackName' ] ] } | |
responses: | |
default: | |
statusCode: "200" | |
passthroughBehavior: "when_no_match" | |
httpMethod: "POST" | |
contentHandling: "CONVERT_TO_TEXT" | |
type: "aws_proxy" | |
definitions: | |
Empty: | |
type: "object" | |
title: "Empty Schema" | |
x-amazon-apigateway-binary-media-types: | |
- "application/protobuf" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment