-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmpl-swagger.go
62 lines (58 loc) · 1.47 KB
/
tmpl-swagger.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package main
const swagger = `
---
openapi: "3.0.1"
{{ if and (eq .APIEndpoints "private") }}
x-amazon-apigateway-policy:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal: "*"
Action:
- "execute-api:Invoke"
Resource: "execute-api:/*"
Condition:
StringEquals:
aws:SourceVpc:
Ref: VPCId
{{ else }}
{{ end }}
info:
title: {{ .APIProjectName }}
description: your awesome description here
version: "v1.0"
servers:
- url: https://apigw-url.example.com/prod
description: Test environment URL
- url: http://apigw-url.example.com/test
description: Production environment URL
paths:
/{{ .LambdaFunctionName }}:
get:
summary: hello world endpoint
description: outputs hello world
responses:
200:
description: "OK"
content:
application/json:
schema:
type: object
items:
$ref: "#/components/schemas/HelloWorldObj"
500:
description: "Internal Server Error"
content: {}
x-amazon-apigateway-integration:
uri:
Fn::Sub: "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${HelloWorldFunction.Arn}/invocations"
httpMethod: POST
passthroughBehavior: "when_no_match"
type: aws_proxy
components:
schemas:
HelloWorldObj:
properties:
msg:
type: "string"
`