|
16 | 16 | } |
17 | 17 | } |
18 | 18 | }, |
| 19 | + "ServerlessDeploymentBucketPolicy": { |
| 20 | + "Type": "AWS::S3::BucketPolicy", |
| 21 | + "Properties": { |
| 22 | + "Bucket": { |
| 23 | + "Ref": "ServerlessDeploymentBucket" |
| 24 | + }, |
| 25 | + "PolicyDocument": { |
| 26 | + "Statement": [ |
| 27 | + { |
| 28 | + "Action": "s3:*", |
| 29 | + "Effect": "Deny", |
| 30 | + "Principal": "*", |
| 31 | + "Resource": [ |
| 32 | + { |
| 33 | + "Fn::Join": [ |
| 34 | + "", |
| 35 | + [ |
| 36 | + "arn:", |
| 37 | + { |
| 38 | + "Ref": "AWS::Partition" |
| 39 | + }, |
| 40 | + ":s3:::", |
| 41 | + { |
| 42 | + "Ref": "ServerlessDeploymentBucket" |
| 43 | + }, |
| 44 | + "/*" |
| 45 | + ] |
| 46 | + ] |
| 47 | + } |
| 48 | + ], |
| 49 | + "Condition": { |
| 50 | + "Bool": { |
| 51 | + "aws:SecureTransport": false |
| 52 | + } |
| 53 | + } |
| 54 | + } |
| 55 | + ] |
| 56 | + } |
| 57 | + } |
| 58 | + }, |
19 | 59 | "GetItemsLogGroup": { |
20 | 60 | "Type": "AWS::Logs::LogGroup", |
21 | 61 | "Properties": { |
|
59 | 99 | "Fn::Join": [ |
60 | 100 | "-", |
61 | 101 | [ |
62 | | - "dev", |
63 | 102 | "serverless-rest-example", |
| 103 | + "dev", |
64 | 104 | "lambda" |
65 | 105 | ] |
66 | 106 | ] |
|
71 | 111 | { |
72 | 112 | "Effect": "Allow", |
73 | 113 | "Action": [ |
74 | | - "logs:CreateLogStream" |
| 114 | + "logs:CreateLogStream", |
| 115 | + "logs:CreateLogGroup" |
75 | 116 | ], |
76 | 117 | "Resource": [ |
77 | 118 | { |
|
129 | 170 | "S3Bucket": { |
130 | 171 | "Ref": "ServerlessDeploymentBucket" |
131 | 172 | }, |
132 | | - "S3Key": "serverless/serverless-rest-example/dev/1578327566259-2020-01-06T16:19:26.259Z/serverless-rest-example.zip" |
| 173 | + "S3Key": "serverless/serverless-rest-example/dev/1617033989378-2021-03-29T16:06:29.378Z/serverless-rest-example.zip" |
133 | 174 | }, |
134 | 175 | "FunctionName": "serverless-rest-example-dev-getItems", |
135 | 176 | "Handler": "dist/manageItems.getItem", |
|
149 | 190 | } |
150 | 191 | }, |
151 | 192 | "DependsOn": [ |
152 | | - "GetItemsLogGroup", |
153 | | - "IamRoleLambdaExecution" |
| 193 | + "GetItemsLogGroup" |
154 | 194 | ] |
155 | 195 | }, |
156 | | - "GetItemsLambdaVersion0FdbsMpyGuJGkKPLMcXz2O5Fr6A6PAjphkZd9wRWqLs": { |
| 196 | + "GetItemsLambdaVersionjYYW7X8gqUHuD34wTZmIV6TNxI7OeAKAwazJ5PGBpM": { |
157 | 197 | "Type": "AWS::Lambda::Version", |
158 | 198 | "DeletionPolicy": "Retain", |
159 | 199 | "Properties": { |
160 | 200 | "FunctionName": { |
161 | 201 | "Ref": "GetItemsLambdaFunction" |
162 | 202 | }, |
163 | | - "CodeSha256": "tB+t5SkNOxx+QNxQ4E2ftCoMGs3colDyH5EWcUn0o84=" |
| 203 | + "CodeSha256": "2Ogo6/XiGDOAWloKcUs3YA4M1KpInrt2bhFfliigu5g=" |
164 | 204 | } |
165 | 205 | }, |
166 | 206 | "UpdateItemsLambdaFunction": { |
|
170 | 210 | "S3Bucket": { |
171 | 211 | "Ref": "ServerlessDeploymentBucket" |
172 | 212 | }, |
173 | | - "S3Key": "serverless/serverless-rest-example/dev/1578327566259-2020-01-06T16:19:26.259Z/serverless-rest-example.zip" |
| 213 | + "S3Key": "serverless/serverless-rest-example/dev/1617033989378-2021-03-29T16:06:29.378Z/serverless-rest-example.zip" |
174 | 214 | }, |
175 | 215 | "FunctionName": "serverless-rest-example-dev-updateItems", |
176 | 216 | "Handler": "dist/manageItems.updateItem", |
|
190 | 230 | } |
191 | 231 | }, |
192 | 232 | "DependsOn": [ |
193 | | - "UpdateItemsLogGroup", |
194 | | - "IamRoleLambdaExecution" |
| 233 | + "UpdateItemsLogGroup" |
195 | 234 | ] |
196 | 235 | }, |
197 | | - "UpdateItemsLambdaVersionTayhisxd9gbffpM8BhEkLl3y2PpIgnLCT1tTmLvTNc": { |
| 236 | + "UpdateItemsLambdaVersions6tcDejjJko6UQQ4aRF4DGweb0oLvV7s6OCVeMCVk": { |
198 | 237 | "Type": "AWS::Lambda::Version", |
199 | 238 | "DeletionPolicy": "Retain", |
200 | 239 | "Properties": { |
201 | 240 | "FunctionName": { |
202 | 241 | "Ref": "UpdateItemsLambdaFunction" |
203 | 242 | }, |
204 | | - "CodeSha256": "tB+t5SkNOxx+QNxQ4E2ftCoMGs3colDyH5EWcUn0o84=" |
| 243 | + "CodeSha256": "2Ogo6/XiGDOAWloKcUs3YA4M1KpInrt2bhFfliigu5g=" |
205 | 244 | } |
206 | 245 | }, |
207 | 246 | "DeleteItemsLambdaFunction": { |
|
211 | 250 | "S3Bucket": { |
212 | 251 | "Ref": "ServerlessDeploymentBucket" |
213 | 252 | }, |
214 | | - "S3Key": "serverless/serverless-rest-example/dev/1578327566259-2020-01-06T16:19:26.259Z/serverless-rest-example.zip" |
| 253 | + "S3Key": "serverless/serverless-rest-example/dev/1617033989378-2021-03-29T16:06:29.378Z/serverless-rest-example.zip" |
215 | 254 | }, |
216 | 255 | "FunctionName": "serverless-rest-example-dev-deleteItems", |
217 | 256 | "Handler": "dist/manageItems.deleteItem", |
|
231 | 270 | } |
232 | 271 | }, |
233 | 272 | "DependsOn": [ |
234 | | - "DeleteItemsLogGroup", |
235 | | - "IamRoleLambdaExecution" |
| 273 | + "DeleteItemsLogGroup" |
236 | 274 | ] |
237 | 275 | }, |
238 | | - "DeleteItemsLambdaVersionstQHAgwZsjbq0blNOuxbWh7M1sPoPdkGEjJUqQNx9w": { |
| 276 | + "DeleteItemsLambdaVersionZAG3AryC7HWe11S5T6bykH2MwzO5ymRkGYbnEEC5k": { |
239 | 277 | "Type": "AWS::Lambda::Version", |
240 | 278 | "DeletionPolicy": "Retain", |
241 | 279 | "Properties": { |
242 | 280 | "FunctionName": { |
243 | 281 | "Ref": "DeleteItemsLambdaFunction" |
244 | 282 | }, |
245 | | - "CodeSha256": "tB+t5SkNOxx+QNxQ4E2ftCoMGs3colDyH5EWcUn0o84=" |
| 283 | + "CodeSha256": "2Ogo6/XiGDOAWloKcUs3YA4M1KpInrt2bhFfliigu5g=" |
246 | 284 | } |
247 | 285 | }, |
248 | 286 | "ApiGatewayRestApi": { |
|
253 | 291 | "Types": [ |
254 | 292 | "EDGE" |
255 | 293 | ] |
256 | | - } |
| 294 | + }, |
| 295 | + "Policy": "" |
257 | 296 | } |
258 | 297 | }, |
259 | 298 | "ApiGatewayResourceItem": { |
|
283 | 322 | } |
284 | 323 | } |
285 | 324 | }, |
286 | | - "ApiGatewayMethodItemOptions": { |
| 325 | + "ApiGatewayMethodItemItemidVarOptions": { |
287 | 326 | "Type": "AWS::ApiGateway::Method", |
288 | 327 | "Properties": { |
289 | 328 | "AuthorizationType": "NONE", |
|
294 | 333 | "ResponseParameters": { |
295 | 334 | "method.response.header.Access-Control-Allow-Origin": true, |
296 | 335 | "method.response.header.Access-Control-Allow-Headers": true, |
297 | | - "method.response.header.Access-Control-Allow-Methods": true, |
298 | | - "method.response.header.Access-Control-Allow-Credentials": true |
| 336 | + "method.response.header.Access-Control-Allow-Methods": true |
299 | 337 | }, |
300 | 338 | "ResponseModels": {} |
301 | 339 | } |
|
313 | 351 | "ResponseParameters": { |
314 | 352 | "method.response.header.Access-Control-Allow-Origin": "'*'", |
315 | 353 | "method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", |
316 | | - "method.response.header.Access-Control-Allow-Methods": "'OPTIONS,POST,GET'", |
317 | | - "method.response.header.Access-Control-Allow-Credentials": "'false'" |
| 354 | + "method.response.header.Access-Control-Allow-Methods": "'OPTIONS,DELETE,POST,GET'" |
318 | 355 | }, |
319 | 356 | "ResponseTemplates": { |
320 | | - "application/json": "#set($origin = $input.params(\"Origin\"))\n#if($origin == \"\") #set($origin = $input.params(\"origin\")) #end\n#if($origin.matches(\".*\")) #set($context.responseOverride.header.Access-Control-Allow-Origin = $origin) #end" |
| 357 | + "application/json": "#set($origin = $input.params(\"Origin\"))\n#if($origin == \"\") #set($origin = $input.params(\"origin\")) #end\n#if($origin.matches(\".+\")) #set($context.responseOverride.header.Access-Control-Allow-Origin = $origin) #end" |
321 | 358 | } |
322 | 359 | } |
323 | 360 | ] |
324 | 361 | }, |
325 | 362 | "ResourceId": { |
326 | | - "Ref": "ApiGatewayResourceItem" |
| 363 | + "Ref": "ApiGatewayResourceItemItemidVar" |
327 | 364 | }, |
328 | 365 | "RestApiId": { |
329 | 366 | "Ref": "ApiGatewayRestApi" |
330 | 367 | } |
331 | 368 | } |
332 | 369 | }, |
333 | | - "ApiGatewayMethodItemItemidVarOptions": { |
| 370 | + "ApiGatewayMethodItemOptions": { |
334 | 371 | "Type": "AWS::ApiGateway::Method", |
335 | 372 | "Properties": { |
336 | 373 | "AuthorizationType": "NONE", |
|
341 | 378 | "ResponseParameters": { |
342 | 379 | "method.response.header.Access-Control-Allow-Origin": true, |
343 | 380 | "method.response.header.Access-Control-Allow-Headers": true, |
344 | | - "method.response.header.Access-Control-Allow-Methods": true, |
345 | | - "method.response.header.Access-Control-Allow-Credentials": true |
| 381 | + "method.response.header.Access-Control-Allow-Methods": true |
346 | 382 | }, |
347 | 383 | "ResponseModels": {} |
348 | 384 | } |
|
360 | 396 | "ResponseParameters": { |
361 | 397 | "method.response.header.Access-Control-Allow-Origin": "'*'", |
362 | 398 | "method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent'", |
363 | | - "method.response.header.Access-Control-Allow-Methods": "'OPTIONS,DELETE,POST,GET'", |
364 | | - "method.response.header.Access-Control-Allow-Credentials": "'false'" |
| 399 | + "method.response.header.Access-Control-Allow-Methods": "'OPTIONS,POST'" |
365 | 400 | }, |
366 | 401 | "ResponseTemplates": { |
367 | | - "application/json": "#set($origin = $input.params(\"Origin\"))\n#if($origin == \"\") #set($origin = $input.params(\"origin\")) #end\n#if($origin.matches(\".*\")) #set($context.responseOverride.header.Access-Control-Allow-Origin = $origin) #end" |
| 402 | + "application/json": "#set($origin = $input.params(\"Origin\"))\n#if($origin == \"\") #set($origin = $input.params(\"origin\")) #end\n#if($origin.matches(\".+\")) #set($context.responseOverride.header.Access-Control-Allow-Origin = $origin) #end" |
368 | 403 | } |
369 | 404 | } |
370 | 405 | ] |
371 | 406 | }, |
372 | | - "ResourceId": { |
373 | | - "Ref": "ApiGatewayResourceItemItemidVar" |
374 | | - }, |
375 | | - "RestApiId": { |
376 | | - "Ref": "ApiGatewayRestApi" |
377 | | - } |
378 | | - } |
379 | | - }, |
380 | | - "ApiGatewayMethodItemGet": { |
381 | | - "Type": "AWS::ApiGateway::Method", |
382 | | - "Properties": { |
383 | | - "HttpMethod": "GET", |
384 | | - "RequestParameters": {}, |
385 | 407 | "ResourceId": { |
386 | 408 | "Ref": "ApiGatewayResourceItem" |
387 | 409 | }, |
388 | 410 | "RestApiId": { |
389 | 411 | "Ref": "ApiGatewayRestApi" |
390 | | - }, |
391 | | - "ApiKeyRequired": false, |
392 | | - "AuthorizationType": "NONE", |
393 | | - "Integration": { |
394 | | - "IntegrationHttpMethod": "POST", |
395 | | - "Type": "AWS_PROXY", |
396 | | - "Uri": { |
397 | | - "Fn::Join": [ |
398 | | - "", |
399 | | - [ |
400 | | - "arn:", |
401 | | - { |
402 | | - "Ref": "AWS::Partition" |
403 | | - }, |
404 | | - ":apigateway:", |
405 | | - { |
406 | | - "Ref": "AWS::Region" |
407 | | - }, |
408 | | - ":lambda:path/2015-03-31/functions/", |
409 | | - { |
410 | | - "Fn::GetAtt": [ |
411 | | - "GetItemsLambdaFunction", |
412 | | - "Arn" |
413 | | - ] |
414 | | - }, |
415 | | - "/invocations" |
416 | | - ] |
417 | | - ] |
418 | | - } |
419 | | - }, |
420 | | - "MethodResponses": [] |
| 412 | + } |
421 | 413 | } |
422 | 414 | }, |
423 | 415 | "ApiGatewayMethodItemItemidVarGet": { |
|
592 | 584 | "MethodResponses": [] |
593 | 585 | } |
594 | 586 | }, |
595 | | - "ApiGatewayDeployment1578327561025": { |
| 587 | + "ApiGatewayDeployment1617033986619": { |
596 | 588 | "Type": "AWS::ApiGateway::Deployment", |
597 | 589 | "Properties": { |
598 | 590 | "RestApiId": { |
|
601 | 593 | "StageName": "dev" |
602 | 594 | }, |
603 | 595 | "DependsOn": [ |
604 | | - "ApiGatewayMethodItemOptions", |
605 | 596 | "ApiGatewayMethodItemItemidVarOptions", |
606 | | - "ApiGatewayMethodItemGet", |
| 597 | + "ApiGatewayMethodItemOptions", |
607 | 598 | "ApiGatewayMethodItemItemidVarGet", |
608 | 599 | "ApiGatewayMethodItemPost", |
609 | 600 | "ApiGatewayMethodItemItemidVarPost", |
|
753 | 744 | "GetItemsLambdaFunctionQualifiedArn": { |
754 | 745 | "Description": "Current Lambda function version", |
755 | 746 | "Value": { |
756 | | - "Ref": "GetItemsLambdaVersion0FdbsMpyGuJGkKPLMcXz2O5Fr6A6PAjphkZd9wRWqLs" |
| 747 | + "Ref": "GetItemsLambdaVersionjYYW7X8gqUHuD34wTZmIV6TNxI7OeAKAwazJ5PGBpM" |
757 | 748 | } |
758 | 749 | }, |
759 | 750 | "UpdateItemsLambdaFunctionQualifiedArn": { |
760 | 751 | "Description": "Current Lambda function version", |
761 | 752 | "Value": { |
762 | | - "Ref": "UpdateItemsLambdaVersionTayhisxd9gbffpM8BhEkLl3y2PpIgnLCT1tTmLvTNc" |
| 753 | + "Ref": "UpdateItemsLambdaVersions6tcDejjJko6UQQ4aRF4DGweb0oLvV7s6OCVeMCVk" |
763 | 754 | } |
764 | 755 | }, |
765 | 756 | "DeleteItemsLambdaFunctionQualifiedArn": { |
766 | 757 | "Description": "Current Lambda function version", |
767 | 758 | "Value": { |
768 | | - "Ref": "DeleteItemsLambdaVersionstQHAgwZsjbq0blNOuxbWh7M1sPoPdkGEjJUqQNx9w" |
| 759 | + "Ref": "DeleteItemsLambdaVersionZAG3AryC7HWe11S5T6bykH2MwzO5ymRkGYbnEEC5k" |
769 | 760 | } |
770 | 761 | }, |
771 | 762 | "ServiceEndpoint": { |
|
0 commit comments