Amazon API Gateway Mock Integration built with CloudFormation: Difference between revisions
Jump to navigation
Jump to search
Line 12: | Line 12: | ||
<syntaxhighlight lang='yaml'> | <syntaxhighlight lang='yaml'> | ||
--- | |||
swagger: "2.0" | |||
info: | |||
version: "2019-03-27T20:21:37Z" | |||
title: "elysium" | |||
host: "7pc5pztvdi.execute-api.us-west-2.amazonaws.com" | |||
basePath: "/test" | |||
schemes: | |||
- "https" | |||
paths: | |||
/a: | |||
get: | |||
consumes: | |||
- "application/json" | |||
produces: | |||
- "application/json" | |||
responses: | |||
200: | |||
description: "200 response" | |||
schema: | |||
$ref: "#/definitions/Empty" | |||
x-amazon-apigateway-integration: | |||
responses: | |||
default: | |||
statusCode: "200" | |||
passthroughBehavior: "when_no_match" | |||
requestTemplates: | |||
application/json: "{\"statusCode\": 200}" | |||
type: "mock" | |||
definitions: | |||
Empty: | |||
type: "object" | |||
title: "Empty Schema" | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 20:22, 27 March 2019
Internal
CloudFormation Stack
OpenAPI AWS Specification
---
swagger: "2.0"
info:
version: "2019-03-27T20:21:37Z"
title: "elysium"
host: "7pc5pztvdi.execute-api.us-west-2.amazonaws.com"
basePath: "/test"
schemes:
- "https"
paths:
/a:
get:
consumes:
- "application/json"
produces:
- "application/json"
responses:
200:
description: "200 response"
schema:
$ref: "#/definitions/Empty"
x-amazon-apigateway-integration:
responses:
default:
statusCode: "200"
passthroughBehavior: "when_no_match"
requestTemplates:
application/json: "{\"statusCode\": 200}"
type: "mock"
definitions:
Empty:
type: "object"
title: "Empty Schema"
Procedure
- Copy the OpenAPI AWS metadata file in S3.
- Deploy the stack:
aws cloudformation deploy --stack-name elysium