Skip to content

Instantly share code, notes, and snippets.

@h-parekh
Last active June 27, 2018 17:46
Show Gist options
  • Save h-parekh/4e9c7ebf551e09e26e0e6975a6b02805 to your computer and use it in GitHub Desktop.
Save h-parekh/4e9c7ebf551e09e26e0e6975a6b02805 to your computer and use it in GitHub Desktop.
Sample swagger 2.0 document
AWSTemplateFormatVersion: "2010-09-09"
Description: "Portal Resources Gateway"
Parameters:
ServiceName:
Type: String
Description: The name of the service
HoursArn:
Type: String
Description: Arn for the Hours Lambda
Outputs:
GatewayId:
Value: !Ref Gateway
Resources:
GatewayStage:
Type: AWS::ApiGateway::Deployment
DependsOn: Gateway
Properties:
RestApiId: !Ref Gateway
StageName: !Ref Stage
Gateway:
Type: AWS::ApiGateway::RestApi
Properties:
Name: !Ref ServiceName
Description: Get personalized library resources
Body:
swagger: "2.0"
info:
version: "v1.2.3"
title: "hours_API"
schemes:
- "https"
paths:
/hours:
get:
responses:
"200":
description: The Checked out resource information
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Headers:
type: "string"
schema:
$ref: '#/definitions/OutList'
x-amazon-apigateway-integration:
uri:
Fn::Join:
- ''
- - "arn:aws:apigateway:"
- !Ref AWS::Region
- ":lambda:path/"
- !Ref HoursArn
- "/invocations"
passthroughBehavior: "when_no_match"
httpMethod: "POST"
type: "aws_proxy"
definitions:
OutList:
type: object
properties:
locations:
type: string
properties:
1:
type: string
2:
type: string
swagger: "2.0"
info:
version: "v1.2.3"
title: "hours_API"
schemes:
- "https"
paths:
/hours:
get:
responses:
"200":
description: The Checked out resource information
headers:
Access-Control-Allow-Origin:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Headers:
type: "string"
schema:
$ref: '#/definitions/OutList'
definitions:
OutList:
type: object
properties:
locations:
type: string
properties:
1:
type: string
2:
type: string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment