forked from aliyun/ros-templates
-
Notifications
You must be signed in to change notification settings - Fork 1
/
api.yml
240 lines (240 loc) · 5.05 KB
/
api.yml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
ROSTemplateFormatVersion: '2015-09-01'
Description: ApiGateway Api/Group/App/Deployment/Authorization/Signature/SignatureBinding/TrafficControl/TrafficControlBinding/
resource example
Parameters:
RoleName:
Type: String
Default: mytest
PolicyName:
Type: String
Default: mytest
TrafficControlName:
Type: String
Default: mytest
InstanceId:
Type: String
Default: api-shared-vpc-001
AllowedValues:
- api-shared-vpc-001
- api-shared-classic-001
GroupName:
Type: String
Default: mytest
ServiceName:
Type: String
Default: mytest
ApiName:
Type: String
Default: mytest
AppName:
Type: String
Default: mytest
SignatureSecret:
Type: String
Default: mytest
SignatureName:
Type: String
Default: mytest
SignatureKey:
Type: String
Default: mytest
Resources:
RamRole:
Type: ALIYUN::RAM::Role
Properties:
RoleName:
Ref: RoleName
Policies:
- PolicyName:
Ref: PolicyName
PolicyDocument:
Version: '1'
Statement:
- Action:
- fc:InvokeFunction
Resource:
- '*'
Effect: Allow
AssumeRolePolicyDocument:
Version: '1'
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service:
- apigateway.aliyuncs.com
FCService:
Type: ALIYUN::FC::Service
Properties:
ServiceName:
Ref: ServiceName
InternetAccess: true
Function:
Type: ALIYUN::FC::Function
Properties:
Handler: index.handler
Runtime: python3
Code:
SourceCode: "def handler(event, context):\n\treturn {'isBase64Encode': False,\
\ 'statusCode': 200, 'body': 'Hello World!', 'headers': {'Content-type':\
\ 'aplication/json'}}\n"
FunctionName: mytest
ServiceName:
Fn::GetAtt:
- FCService
- ServiceName
MemorySize: 128
DependsOn: FCService
Group:
Type: ALIYUN::ApiGateway::Group
Properties:
InstanceId:
Ref: InstanceId
GroupName:
Ref: GroupName
Api:
Type: ALIYUN::ApiGateway::Api
Properties:
AppCodeAuthType: HEADER_QUERY
AuthType: APP
ServiceConfig:
FunctionComputeConfig:
fcRegionId:
Ref: ALIYUN::Region
qualifier: LATEST
roleArn:
Fn::GetAtt:
- RamRole
- Arn
serviceName:
Fn::GetAtt:
- FCService
- ServiceName
functionName:
Fn::GetAtt:
- Function
- FunctionName
ServiceProtocol: FunctionCompute
ContentTypeCatagory: CLIENT
RequestConfig:
RequestMode: MAPPING
RequestHttpMethod: POST
RequestProtocol: HTTP,HTTPS
RequestPath: /test
BodyFormat: FORM
ResultSample: ''
Visibility: PRIVATE
ResultType: JSON
ApiName:
Ref: ApiName
GroupId:
Fn::GetAtt:
- Group
- GroupId
DependsOn:
- Group
- RamRole
App:
Type: ALIYUN::ApiGateway::App
Properties:
Description: Test Create App
AppName:
Ref: AppName
Deployment:
Type: ALIYUN::ApiGateway::Deployment
Properties:
ApiId:
Ref: Api
GroupId:
Ref: Group
StageName: TEST
Description: TEST
Authorization:
Type: ALIYUN::ApiGateway::Authorization
Properties:
ApiIds:
- Ref: Api
AppIds:
- Ref: App
GroupId:
Ref: Group
StageName: TEST
DependsOn:
- Api
- App
- Deployment
Signature:
Type: ALIYUN::ApiGateway::Signature
Properties:
SignatureSecret:
Ref: SignatureSecret
SignatureName:
Ref: SignatureName
SignatureKey:
Ref: SignatureKey
SignatureBinding:
Type: ALIYUN::ApiGateway::SignatureBinding
Properties:
ApiIds:
- Ref: Api
GroupId:
Ref: Group
StageName: TEST
SignatureId:
Ref: Signature
DependsOn: Authorization
TrafficControl:
Type: ALIYUN::ApiGateway::TrafficControl
Properties:
TrafficControlName:
Ref: TrafficControlName
Description: Test TrafficControl
TrafficControlUnit: HOUR
ApiDefault: 10
TrafficControlBinding:
Type: ALIYUN::ApiGateway::TrafficControlBinding
Properties:
ApiIds:
- Ref: Api
TrafficControlId:
Ref: TrafficControl
StageName: TEST
GroupId:
Ref: Group
DependsOn: SignatureBinding
Outputs:
SignatureId:
Value:
Fn::GetAtt:
- Signature
- SignatureId
SubDomain:
Value:
Fn::GetAtt:
- Group
- SubDomain
GroupId:
Value:
Fn::GetAtt:
- Group
- GroupId
AppKey:
Value:
Fn::GetAtt:
- App
- AppKey
AppSecret:
Value:
Fn::GetAtt:
- App
- AppSecret
AppId:
Value:
Fn::GetAtt:
- App
- AppId
ApiId:
Value:
Fn::GetAtt:
- Api
- ApiId