Last active
October 22, 2016 02:19
-
-
Save moduspwnens/11964067bc66374b0e94a1570271a7bf to your computer and use it in GitHub Desktop.
Sample API Gateway Method
This file contains 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
{ | |
"WebChatApiUserIdCreateMethod": { | |
"Type": "AWS::ApiGateway::Method", | |
"Properties": { | |
"AuthorizationType": "NONE", | |
"ResourceId": { | |
"Ref": "WebChatApiUserResource" | |
}, | |
"RestApiId": { | |
"Ref": "WebChatApi" | |
}, | |
"HttpMethod": "POST", | |
"Integration": { | |
"IntegrationHttpMethod": "POST", | |
"IntegrationResponses": [ | |
{ | |
"SelectionPattern": "", | |
"StatusCode": "200" | |
}, | |
{ | |
"ResponseTemplates": { | |
"application/json": "{\n \"type\": \"InternalServerError\",\n \"message\": \"The backend server encountered an internal error.\"\n}" | |
}, | |
"SelectionPattern": "(\\n|.)+", | |
"StatusCode": "500" | |
}, | |
{ | |
"ResponseTemplates": { | |
"application/json": "{\n \"type\": \"InternalServerTimeout\",\n \"message\": \"The backend server did not respond quickly enough.\"\n}" | |
}, | |
"SelectionPattern": ".*Task timed out after .*", | |
"StatusCode": "504" | |
} | |
], | |
"PassthroughBehavior": "NEVER", | |
"RequestTemplates": { | |
"application/json": { | |
"Fn::Sub": "{\n \"api-id\": \"$context.apiId\",\n \"host\": \"$input.params('Host')\",\n \"stage\": \"$context.stage\",\n \"request-body\": $input.json(\"$\"),\n \"resource-path\": \"$context.resourcePath\"\n}" | |
} | |
}, | |
"Type": "AWS", | |
"Uri": { | |
"Fn::Sub": [ | |
"arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${UserIdGeneratorFunctionArn}/invocations", { | |
"UserIdGeneratorFunctionArn": { | |
"Fn::GetAtt": [ | |
"UserIdGeneratorFunction", | |
"Arn" | |
] | |
} | |
} | |
] | |
} | |
}, | |
"MethodResponses": [ | |
{ | |
"StatusCode": "200" | |
}, | |
{ | |
"StatusCode": "500" | |
}, | |
{ | |
"StatusCode": "504" | |
} | |
], | |
"RequestParameters": { | |
"method.request.header.Host": true | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment