16
16
"HttpApiFunctionRole" : {
17
17
"Type" : " AWS::IAM::Role" ,
18
18
"Properties" : {
19
- "ManagedPolicyArns" : [
20
- " arn:aws-cn:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ,
21
- " arn:aws-cn:iam::aws:policy/AmazonDynamoDBFullAccess"
22
- ],
23
19
"AssumeRolePolicyDocument" : {
24
20
"Version" : " 2012-10-17" ,
25
21
"Statement" : [
36
32
}
37
33
]
38
34
},
35
+ "ManagedPolicyArns" : [
36
+ " arn:aws-cn:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ,
37
+ " arn:aws-cn:iam::aws:policy/AmazonDynamoDBFullAccess"
38
+ ],
39
39
"Tags" : [
40
40
{
41
41
"Value" : " SAM" ,
47
47
"HttpApiFunction2Role" : {
48
48
"Type" : " AWS::IAM::Role" ,
49
49
"Properties" : {
50
- "ManagedPolicyArns" : [
51
- " arn:aws-cn:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ,
52
- " arn:aws-cn:iam::aws:policy/AmazonDynamoDBFullAccess"
53
- ],
54
50
"AssumeRolePolicyDocument" : {
55
51
"Version" : " 2012-10-17" ,
56
52
"Statement" : [
67
63
}
68
64
]
69
65
},
66
+ "ManagedPolicyArns" : [
67
+ " arn:aws-cn:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" ,
68
+ " arn:aws-cn:iam::aws:policy/AmazonDynamoDBFullAccess"
69
+ ],
70
+ "Tags" : [
71
+ {
72
+ "Value" : " SAM" ,
73
+ "Key" : " lambda:createdBy"
74
+ }
75
+ ]
76
+ }
77
+ },
78
+ "HttpApiFunction" : {
79
+ "Type" : " AWS::Lambda::Function" ,
80
+ "Properties" : {
81
+ "Handler" : " index.restapi" ,
82
+ "Code" : {
83
+ "S3Bucket" : " sam-demo-bucket" ,
84
+ "S3Key" : " todo_list.zip"
85
+ },
86
+ "Role" : {
87
+ "Fn::GetAtt" : [
88
+ " HttpApiFunctionRole" ,
89
+ " Arn"
90
+ ]
91
+ },
92
+ "Runtime" : " nodejs12.x" ,
93
+ "Tags" : [
94
+ {
95
+ "Value" : " SAM" ,
96
+ "Key" : " lambda:createdBy"
97
+ }
98
+ ]
99
+ }
100
+ },
101
+ "HttpApiFunctionSimpleCasePermission" : {
102
+ "Type" : " AWS::Lambda::Permission" ,
103
+ "Properties" : {
104
+ "Action" : " lambda:InvokeFunction" ,
105
+ "Principal" : " apigateway.amazonaws.com" ,
106
+ "FunctionName" : {
107
+ "Ref" : " HttpApiFunction"
108
+ },
109
+ "SourceArn" : {
110
+ "Fn::Sub" : [
111
+ " arn:${AWS::Partition}:execute-api:${AWS::Region}:${AWS::AccountId}:${__ApiId__}/${__Stage__}/*" ,
112
+ {
113
+ "__Stage__" : " *" ,
114
+ "__ApiId__" : {
115
+ "Ref" : " ServerlessHttpApi"
116
+ }
117
+ }
118
+ ]
119
+ }
120
+ }
121
+ },
122
+ "HttpApiFunction2" : {
123
+ "Type" : " AWS::Lambda::Function" ,
124
+ "Properties" : {
125
+ "Handler" : " index.restapi" ,
126
+ "Code" : {
127
+ "S3Bucket" : " sam-demo-bucket" ,
128
+ "S3Key" : " todo_list.zip"
129
+ },
130
+ "Role" : {
131
+ "Fn::GetAtt" : [
132
+ " HttpApiFunction2Role" ,
133
+ " Arn"
134
+ ]
135
+ },
136
+ "Runtime" : " nodejs12.x" ,
70
137
"Tags" : [
71
138
{
72
139
"Value" : " SAM" ,
85
152
"Ref" : " AWS::StackName"
86
153
}
87
154
},
88
- "tags" : [
89
- {
90
- "name" : " httpapi:createdBy" ,
91
- "x-amazon-apigateway-tag-value" : " SAM"
92
- }
93
- ],
94
155
"paths" : {
95
156
"/basic2" : {
96
157
"post" : {
105
166
"responses" : {}
106
167
}
107
168
},
108
- "/basic " : {
169
+ "/get/{something}/with/{params} " : {
109
170
"post" : {
110
171
"x-amazon-apigateway-integration" : {
111
172
"httpMethod" : " POST" ,
112
173
"type" : " aws_proxy" ,
113
174
"uri" : {
114
- "Fn::Sub" : " arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${HttpApiFunction .Arn}/invocations"
175
+ "Fn::Sub" : " arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${HttpApiFunction2 .Arn}/invocations"
115
176
},
116
177
"payloadFormatVersion" : " 1.0"
117
178
},
118
- "responses" : {}
179
+ "responses" : {},
180
+ "parameters" : [
181
+ {
182
+ "required" : true ,
183
+ "name" : " something" ,
184
+ "in" : " path"
185
+ },
186
+ {
187
+ "required" : true ,
188
+ "name" : " params" ,
189
+ "in" : " path"
190
+ }
191
+ ]
119
192
}
120
193
},
121
194
"$default" : {
131
204
"isDefaultRoute" : true ,
132
205
"responses" : {}
133
206
}
207
+ },
208
+ "/basic" : {
209
+ "post" : {
210
+ "x-amazon-apigateway-integration" : {
211
+ "httpMethod" : " POST" ,
212
+ "type" : " aws_proxy" ,
213
+ "uri" : {
214
+ "Fn::Sub" : " arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${HttpApiFunction.Arn}/invocations"
215
+ },
216
+ "payloadFormatVersion" : " 1.0"
217
+ },
218
+ "responses" : {}
219
+ }
134
220
}
135
221
},
136
- "openapi" : " 3.0.1"
222
+ "openapi" : " 3.0.1" ,
223
+ "tags" : [
224
+ {
225
+ "name" : " httpapi:createdBy" ,
226
+ "x-amazon-apigateway-tag-value" : " SAM"
227
+ }
228
+ ]
137
229
}
138
230
}
139
231
},
140
- "HttpApiFunctionSimpleCasePermission " : {
232
+ "HttpApiFunction2PathParametersPermission " : {
141
233
"Type" : " AWS::Lambda::Permission" ,
142
234
"Properties" : {
143
235
"Action" : " lambda:InvokeFunction" ,
144
236
"Principal" : " apigateway.amazonaws.com" ,
145
237
"FunctionName" : {
146
- "Ref" : " HttpApiFunction "
238
+ "Ref" : " HttpApiFunction2 "
147
239
},
148
240
"SourceArn" : {
149
241
"Fn::Sub" : [
150
- " arn:${AWS::Partition}:execute-api:${AWS::Region}:${AWS::AccountId}:${__ApiId__}/${__Stage__}/*" ,
242
+ " arn:${AWS::Partition}:execute-api:${AWS::Region}:${AWS::AccountId}:${__ApiId__}/${__Stage__}/POST/get/*/with/ *" ,
151
243
{
152
244
"__Stage__" : " *" ,
153
245
"__ApiId__" : {
158
250
}
159
251
}
160
252
},
161
- "HttpApiFunction2" : {
162
- "Type" : " AWS::Lambda::Function" ,
163
- "Properties" : {
164
- "Handler" : " index.restapi" ,
165
- "Code" : {
166
- "S3Bucket" : " sam-demo-bucket" ,
167
- "S3Key" : " todo_list.zip"
168
- },
169
- "Role" : {
170
- "Fn::GetAtt" : [
171
- " HttpApiFunction2Role" ,
172
- " Arn"
173
- ]
174
- },
175
- "Runtime" : " nodejs12.x" ,
176
- "Tags" : [
177
- {
178
- "Value" : " SAM" ,
179
- "Key" : " lambda:createdBy"
180
- }
181
- ]
182
- }
183
- },
184
- "HttpApiFunction" : {
185
- "Type" : " AWS::Lambda::Function" ,
186
- "Properties" : {
187
- "Handler" : " index.restapi" ,
188
- "Code" : {
189
- "S3Bucket" : " sam-demo-bucket" ,
190
- "S3Key" : " todo_list.zip"
191
- },
192
- "Role" : {
193
- "Fn::GetAtt" : [
194
- " HttpApiFunctionRole" ,
195
- " Arn"
196
- ]
197
- },
198
- "Runtime" : " nodejs12.x" ,
199
- "Tags" : [
200
- {
201
- "Value" : " SAM" ,
202
- "Key" : " lambda:createdBy"
203
- }
204
- ]
205
- }
206
- },
207
253
"HttpApiFunction2Basic2Permission" : {
208
254
"Type" : " AWS::Lambda::Permission" ,
209
255
"Properties" : {
226
272
}
227
273
}
228
274
}
229
- }
275
+ }
0 commit comments