@aws-solutions-constructs/aws-apigateway-lambda 2.51.0 → 2.52.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/.eslintignore +5 -1
  2. package/.jsii +49 -4
  3. package/integ.config.json +7 -0
  4. package/lib/index.js +1 -1
  5. package/package.json +9 -8
  6. package/test/integ.apilam-deployFunction.js +5 -2
  7. package/test/integ.apilam-deployFunction.js.snapshot/apilam-deployFunction.assets.json +32 -0
  8. package/test/integ.apilam-deployFunction.js.snapshot/apilam-deployFunction.template.json +632 -0
  9. package/test/integ.apilam-deployFunction.js.snapshot/apilamdeployFunctionIntegDefaultTestDeployAssert281C111D.assets.json +19 -0
  10. package/test/integ.apilam-deployFunction.js.snapshot/apilamdeployFunctionIntegDefaultTestDeployAssert281C111D.template.json +36 -0
  11. package/test/integ.apilam-deployFunction.js.snapshot/asset.0904d3723480fed2daf7885caa427b930881caae6879d1e6b0d395020173ef6f/index.js +21 -0
  12. package/test/integ.apilam-deployFunction.js.snapshot/cdk.out +1 -0
  13. package/test/integ.apilam-deployFunction.js.snapshot/integ.json +12 -0
  14. package/test/integ.apilam-deployFunction.js.snapshot/manifest.json +215 -0
  15. package/test/integ.apilam-deployFunction.js.snapshot/tree.json +927 -0
  16. package/test/integ.apilam-existingFunction.js +5 -2
  17. package/test/integ.apilam-existingFunction.js.snapshot/apilam-existingFunction.assets.json +32 -0
  18. package/test/integ.apilam-existingFunction.js.snapshot/apilam-existingFunction.template.json +632 -0
  19. package/test/integ.apilam-existingFunction.js.snapshot/apilamexistingFunctionIntegDefaultTestDeployAssert4238FD03.assets.json +19 -0
  20. package/test/integ.apilam-existingFunction.js.snapshot/apilamexistingFunctionIntegDefaultTestDeployAssert4238FD03.template.json +36 -0
  21. package/test/integ.apilam-existingFunction.js.snapshot/asset.0904d3723480fed2daf7885caa427b930881caae6879d1e6b0d395020173ef6f/index.js +21 -0
  22. package/test/integ.apilam-existingFunction.js.snapshot/cdk.out +1 -0
  23. package/test/integ.apilam-existingFunction.js.snapshot/integ.json +12 -0
  24. package/test/integ.apilam-existingFunction.js.snapshot/manifest.json +215 -0
  25. package/test/integ.apilam-existingFunction.js.snapshot/tree.json +927 -0
  26. package/test/integ.apilam-deployFunction.expected.json +0 -632
  27. package/test/integ.apilam-existingFunction.expected.json +0 -632
@@ -1,632 +0,0 @@
1
- {
2
- "Description": "Integration Test for aws-apigateway-lambda",
3
- "Resources": {
4
- "testapigatewaylambdaLambdaFunctionServiceRole5CD2E9F7": {
5
- "Type": "AWS::IAM::Role",
6
- "Properties": {
7
- "AssumeRolePolicyDocument": {
8
- "Statement": [
9
- {
10
- "Action": "sts:AssumeRole",
11
- "Effect": "Allow",
12
- "Principal": {
13
- "Service": "lambda.amazonaws.com"
14
- }
15
- }
16
- ],
17
- "Version": "2012-10-17"
18
- },
19
- "Policies": [
20
- {
21
- "PolicyDocument": {
22
- "Statement": [
23
- {
24
- "Action": [
25
- "logs:CreateLogGroup",
26
- "logs:CreateLogStream",
27
- "logs:PutLogEvents"
28
- ],
29
- "Effect": "Allow",
30
- "Resource": {
31
- "Fn::Join": [
32
- "",
33
- [
34
- "arn:",
35
- {
36
- "Ref": "AWS::Partition"
37
- },
38
- ":logs:",
39
- {
40
- "Ref": "AWS::Region"
41
- },
42
- ":",
43
- {
44
- "Ref": "AWS::AccountId"
45
- },
46
- ":log-group:/aws/lambda/*"
47
- ]
48
- ]
49
- }
50
- }
51
- ],
52
- "Version": "2012-10-17"
53
- },
54
- "PolicyName": "LambdaFunctionServiceRolePolicy"
55
- }
56
- ]
57
- }
58
- },
59
- "testapigatewaylambdaLambdaFunctionServiceRoleDefaultPolicyA5D0BE32": {
60
- "Type": "AWS::IAM::Policy",
61
- "Properties": {
62
- "PolicyDocument": {
63
- "Statement": [
64
- {
65
- "Action": [
66
- "xray:PutTraceSegments",
67
- "xray:PutTelemetryRecords"
68
- ],
69
- "Effect": "Allow",
70
- "Resource": "*"
71
- }
72
- ],
73
- "Version": "2012-10-17"
74
- },
75
- "PolicyName": "testapigatewaylambdaLambdaFunctionServiceRoleDefaultPolicyA5D0BE32",
76
- "Roles": [
77
- {
78
- "Ref": "testapigatewaylambdaLambdaFunctionServiceRole5CD2E9F7"
79
- }
80
- ]
81
- },
82
- "Metadata": {
83
- "cfn_nag": {
84
- "rules_to_suppress": [
85
- {
86
- "id": "W12",
87
- "reason": "Lambda needs the following minimum required permissions to send trace data to X-Ray and access ENIs in a VPC."
88
- }
89
- ]
90
- }
91
- }
92
- },
93
- "testapigatewaylambdaLambdaFunction18FF222F": {
94
- "Type": "AWS::Lambda::Function",
95
- "Properties": {
96
- "Code": {
97
- "S3Bucket": {
98
- "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
99
- },
100
- "S3Key": "0904d3723480fed2daf7885caa427b930881caae6879d1e6b0d395020173ef6f.zip"
101
- },
102
- "Environment": {
103
- "Variables": {
104
- "AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1"
105
- }
106
- },
107
- "Handler": "index.handler",
108
- "Role": {
109
- "Fn::GetAtt": [
110
- "testapigatewaylambdaLambdaFunctionServiceRole5CD2E9F7",
111
- "Arn"
112
- ]
113
- },
114
- "Runtime": "nodejs16.x",
115
- "TracingConfig": {
116
- "Mode": "Active"
117
- }
118
- },
119
- "DependsOn": [
120
- "testapigatewaylambdaLambdaFunctionServiceRoleDefaultPolicyA5D0BE32",
121
- "testapigatewaylambdaLambdaFunctionServiceRole5CD2E9F7"
122
- ],
123
- "Metadata": {
124
- "cfn_nag": {
125
- "rules_to_suppress": [
126
- {
127
- "id": "W58",
128
- "reason": "Lambda functions has the required permission to write CloudWatch Logs. It uses custom policy instead of arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole with tighter permissions."
129
- },
130
- {
131
- "id": "W89",
132
- "reason": "This is not a rule for the general case, just for specific use cases/industries"
133
- },
134
- {
135
- "id": "W92",
136
- "reason": "Impossible for us to define the correct concurrency for clients"
137
- }
138
- ]
139
- }
140
- }
141
- },
142
- "testapigatewaylambdaApiAccessLogGroupEB3253A2": {
143
- "Type": "AWS::Logs::LogGroup",
144
- "UpdateReplacePolicy": "Retain",
145
- "DeletionPolicy": "Retain",
146
- "Metadata": {
147
- "cfn_nag": {
148
- "rules_to_suppress": [
149
- {
150
- "id": "W86",
151
- "reason": "Retention period for CloudWatchLogs LogGroups are set to 'Never Expire' to preserve customer data indefinitely"
152
- },
153
- {
154
- "id": "W84",
155
- "reason": "By default CloudWatchLogs LogGroups data is encrypted using the CloudWatch server-side encryption keys (AWS Managed Keys)"
156
- }
157
- ]
158
- }
159
- }
160
- },
161
- "testapigatewaylambdaLambdaRestApiE957E944": {
162
- "Type": "AWS::ApiGateway::RestApi",
163
- "Properties": {
164
- "EndpointConfiguration": {
165
- "Types": [
166
- "EDGE"
167
- ]
168
- },
169
- "Name": "LambdaRestApi"
170
- }
171
- },
172
- "testapigatewaylambdaLambdaRestApiDeployment85334BB3a1765c45928980e423727978265730d1": {
173
- "Type": "AWS::ApiGateway::Deployment",
174
- "Properties": {
175
- "Description": "Automatically created by the RestApi construct",
176
- "RestApiId": {
177
- "Ref": "testapigatewaylambdaLambdaRestApiE957E944"
178
- }
179
- },
180
- "DependsOn": [
181
- "testapigatewaylambdaLambdaRestApiproxyANYF6150927",
182
- "testapigatewaylambdaLambdaRestApiproxy2C2C544E",
183
- "testapigatewaylambdaLambdaRestApiANY1FACA749"
184
- ],
185
- "Metadata": {
186
- "cfn_nag": {
187
- "rules_to_suppress": [
188
- {
189
- "id": "W45",
190
- "reason": "ApiGateway has AccessLogging enabled in AWS::ApiGateway::Stage resource, but cfn_nag checks for it in AWS::ApiGateway::Deployment resource"
191
- }
192
- ]
193
- }
194
- }
195
- },
196
- "testapigatewaylambdaLambdaRestApiDeploymentStageprod4EBF7247": {
197
- "Type": "AWS::ApiGateway::Stage",
198
- "Properties": {
199
- "AccessLogSetting": {
200
- "DestinationArn": {
201
- "Fn::GetAtt": [
202
- "testapigatewaylambdaApiAccessLogGroupEB3253A2",
203
- "Arn"
204
- ]
205
- },
206
- "Format": "{\"requestId\":\"$context.requestId\",\"ip\":\"$context.identity.sourceIp\",\"user\":\"$context.identity.user\",\"caller\":\"$context.identity.caller\",\"requestTime\":\"$context.requestTime\",\"httpMethod\":\"$context.httpMethod\",\"resourcePath\":\"$context.resourcePath\",\"status\":\"$context.status\",\"protocol\":\"$context.protocol\",\"responseLength\":\"$context.responseLength\"}"
207
- },
208
- "DeploymentId": {
209
- "Ref": "testapigatewaylambdaLambdaRestApiDeployment85334BB3a1765c45928980e423727978265730d1"
210
- },
211
- "MethodSettings": [
212
- {
213
- "DataTraceEnabled": false,
214
- "HttpMethod": "*",
215
- "LoggingLevel": "INFO",
216
- "ResourcePath": "/*"
217
- }
218
- ],
219
- "RestApiId": {
220
- "Ref": "testapigatewaylambdaLambdaRestApiE957E944"
221
- },
222
- "StageName": "prod",
223
- "TracingEnabled": true
224
- }
225
- },
226
- "testapigatewaylambdaLambdaRestApiproxy2C2C544E": {
227
- "Type": "AWS::ApiGateway::Resource",
228
- "Properties": {
229
- "ParentId": {
230
- "Fn::GetAtt": [
231
- "testapigatewaylambdaLambdaRestApiE957E944",
232
- "RootResourceId"
233
- ]
234
- },
235
- "PathPart": "{proxy+}",
236
- "RestApiId": {
237
- "Ref": "testapigatewaylambdaLambdaRestApiE957E944"
238
- }
239
- }
240
- },
241
- "testapigatewaylambdaLambdaRestApiproxyANYApiPermissionapilamdeployFunctiontestapigatewaylambdaLambdaRestApiAF929C5FANYproxy83DC1CFF": {
242
- "Type": "AWS::Lambda::Permission",
243
- "Properties": {
244
- "Action": "lambda:InvokeFunction",
245
- "FunctionName": {
246
- "Fn::GetAtt": [
247
- "testapigatewaylambdaLambdaFunction18FF222F",
248
- "Arn"
249
- ]
250
- },
251
- "Principal": "apigateway.amazonaws.com",
252
- "SourceArn": {
253
- "Fn::Join": [
254
- "",
255
- [
256
- "arn:",
257
- {
258
- "Ref": "AWS::Partition"
259
- },
260
- ":execute-api:",
261
- {
262
- "Ref": "AWS::Region"
263
- },
264
- ":",
265
- {
266
- "Ref": "AWS::AccountId"
267
- },
268
- ":",
269
- {
270
- "Ref": "testapigatewaylambdaLambdaRestApiE957E944"
271
- },
272
- "/",
273
- {
274
- "Ref": "testapigatewaylambdaLambdaRestApiDeploymentStageprod4EBF7247"
275
- },
276
- "/*/*"
277
- ]
278
- ]
279
- }
280
- }
281
- },
282
- "testapigatewaylambdaLambdaRestApiproxyANYApiPermissionTestapilamdeployFunctiontestapigatewaylambdaLambdaRestApiAF929C5FANYproxy46D6E92A": {
283
- "Type": "AWS::Lambda::Permission",
284
- "Properties": {
285
- "Action": "lambda:InvokeFunction",
286
- "FunctionName": {
287
- "Fn::GetAtt": [
288
- "testapigatewaylambdaLambdaFunction18FF222F",
289
- "Arn"
290
- ]
291
- },
292
- "Principal": "apigateway.amazonaws.com",
293
- "SourceArn": {
294
- "Fn::Join": [
295
- "",
296
- [
297
- "arn:",
298
- {
299
- "Ref": "AWS::Partition"
300
- },
301
- ":execute-api:",
302
- {
303
- "Ref": "AWS::Region"
304
- },
305
- ":",
306
- {
307
- "Ref": "AWS::AccountId"
308
- },
309
- ":",
310
- {
311
- "Ref": "testapigatewaylambdaLambdaRestApiE957E944"
312
- },
313
- "/test-invoke-stage/*/*"
314
- ]
315
- ]
316
- }
317
- }
318
- },
319
- "testapigatewaylambdaLambdaRestApiproxyANYF6150927": {
320
- "Type": "AWS::ApiGateway::Method",
321
- "Properties": {
322
- "AuthorizationType": "AWS_IAM",
323
- "HttpMethod": "ANY",
324
- "Integration": {
325
- "IntegrationHttpMethod": "POST",
326
- "Type": "AWS_PROXY",
327
- "Uri": {
328
- "Fn::Join": [
329
- "",
330
- [
331
- "arn:",
332
- {
333
- "Ref": "AWS::Partition"
334
- },
335
- ":apigateway:",
336
- {
337
- "Ref": "AWS::Region"
338
- },
339
- ":lambda:path/2015-03-31/functions/",
340
- {
341
- "Fn::GetAtt": [
342
- "testapigatewaylambdaLambdaFunction18FF222F",
343
- "Arn"
344
- ]
345
- },
346
- "/invocations"
347
- ]
348
- ]
349
- }
350
- },
351
- "ResourceId": {
352
- "Ref": "testapigatewaylambdaLambdaRestApiproxy2C2C544E"
353
- },
354
- "RestApiId": {
355
- "Ref": "testapigatewaylambdaLambdaRestApiE957E944"
356
- }
357
- }
358
- },
359
- "testapigatewaylambdaLambdaRestApiANYApiPermissionapilamdeployFunctiontestapigatewaylambdaLambdaRestApiAF929C5FANY15383DB1": {
360
- "Type": "AWS::Lambda::Permission",
361
- "Properties": {
362
- "Action": "lambda:InvokeFunction",
363
- "FunctionName": {
364
- "Fn::GetAtt": [
365
- "testapigatewaylambdaLambdaFunction18FF222F",
366
- "Arn"
367
- ]
368
- },
369
- "Principal": "apigateway.amazonaws.com",
370
- "SourceArn": {
371
- "Fn::Join": [
372
- "",
373
- [
374
- "arn:",
375
- {
376
- "Ref": "AWS::Partition"
377
- },
378
- ":execute-api:",
379
- {
380
- "Ref": "AWS::Region"
381
- },
382
- ":",
383
- {
384
- "Ref": "AWS::AccountId"
385
- },
386
- ":",
387
- {
388
- "Ref": "testapigatewaylambdaLambdaRestApiE957E944"
389
- },
390
- "/",
391
- {
392
- "Ref": "testapigatewaylambdaLambdaRestApiDeploymentStageprod4EBF7247"
393
- },
394
- "/*/"
395
- ]
396
- ]
397
- }
398
- }
399
- },
400
- "testapigatewaylambdaLambdaRestApiANYApiPermissionTestapilamdeployFunctiontestapigatewaylambdaLambdaRestApiAF929C5FANYC3A64F38": {
401
- "Type": "AWS::Lambda::Permission",
402
- "Properties": {
403
- "Action": "lambda:InvokeFunction",
404
- "FunctionName": {
405
- "Fn::GetAtt": [
406
- "testapigatewaylambdaLambdaFunction18FF222F",
407
- "Arn"
408
- ]
409
- },
410
- "Principal": "apigateway.amazonaws.com",
411
- "SourceArn": {
412
- "Fn::Join": [
413
- "",
414
- [
415
- "arn:",
416
- {
417
- "Ref": "AWS::Partition"
418
- },
419
- ":execute-api:",
420
- {
421
- "Ref": "AWS::Region"
422
- },
423
- ":",
424
- {
425
- "Ref": "AWS::AccountId"
426
- },
427
- ":",
428
- {
429
- "Ref": "testapigatewaylambdaLambdaRestApiE957E944"
430
- },
431
- "/test-invoke-stage/*/"
432
- ]
433
- ]
434
- }
435
- }
436
- },
437
- "testapigatewaylambdaLambdaRestApiANY1FACA749": {
438
- "Type": "AWS::ApiGateway::Method",
439
- "Properties": {
440
- "AuthorizationType": "AWS_IAM",
441
- "HttpMethod": "ANY",
442
- "Integration": {
443
- "IntegrationHttpMethod": "POST",
444
- "Type": "AWS_PROXY",
445
- "Uri": {
446
- "Fn::Join": [
447
- "",
448
- [
449
- "arn:",
450
- {
451
- "Ref": "AWS::Partition"
452
- },
453
- ":apigateway:",
454
- {
455
- "Ref": "AWS::Region"
456
- },
457
- ":lambda:path/2015-03-31/functions/",
458
- {
459
- "Fn::GetAtt": [
460
- "testapigatewaylambdaLambdaFunction18FF222F",
461
- "Arn"
462
- ]
463
- },
464
- "/invocations"
465
- ]
466
- ]
467
- }
468
- },
469
- "ResourceId": {
470
- "Fn::GetAtt": [
471
- "testapigatewaylambdaLambdaRestApiE957E944",
472
- "RootResourceId"
473
- ]
474
- },
475
- "RestApiId": {
476
- "Ref": "testapigatewaylambdaLambdaRestApiE957E944"
477
- }
478
- }
479
- },
480
- "testapigatewaylambdaLambdaRestApiUsagePlan658131E3": {
481
- "Type": "AWS::ApiGateway::UsagePlan",
482
- "Properties": {
483
- "ApiStages": [
484
- {
485
- "ApiId": {
486
- "Ref": "testapigatewaylambdaLambdaRestApiE957E944"
487
- },
488
- "Stage": {
489
- "Ref": "testapigatewaylambdaLambdaRestApiDeploymentStageprod4EBF7247"
490
- },
491
- "Throttle": {}
492
- }
493
- ]
494
- }
495
- },
496
- "testapigatewaylambdaLambdaRestApiCloudWatchRole6D45E039": {
497
- "Type": "AWS::IAM::Role",
498
- "Properties": {
499
- "AssumeRolePolicyDocument": {
500
- "Statement": [
501
- {
502
- "Action": "sts:AssumeRole",
503
- "Effect": "Allow",
504
- "Principal": {
505
- "Service": "apigateway.amazonaws.com"
506
- }
507
- }
508
- ],
509
- "Version": "2012-10-17"
510
- },
511
- "Policies": [
512
- {
513
- "PolicyDocument": {
514
- "Statement": [
515
- {
516
- "Action": [
517
- "logs:CreateLogGroup",
518
- "logs:CreateLogStream",
519
- "logs:DescribeLogGroups",
520
- "logs:DescribeLogStreams",
521
- "logs:PutLogEvents",
522
- "logs:GetLogEvents",
523
- "logs:FilterLogEvents"
524
- ],
525
- "Effect": "Allow",
526
- "Resource": {
527
- "Fn::Join": [
528
- "",
529
- [
530
- "arn:",
531
- {
532
- "Ref": "AWS::Partition"
533
- },
534
- ":logs:",
535
- {
536
- "Ref": "AWS::Region"
537
- },
538
- ":",
539
- {
540
- "Ref": "AWS::AccountId"
541
- },
542
- ":*"
543
- ]
544
- ]
545
- }
546
- }
547
- ],
548
- "Version": "2012-10-17"
549
- },
550
- "PolicyName": "LambdaRestApiCloudWatchRolePolicy"
551
- }
552
- ]
553
- }
554
- },
555
- "testapigatewaylambdaLambdaRestApiAccount0D88B6B8": {
556
- "Type": "AWS::ApiGateway::Account",
557
- "Properties": {
558
- "CloudWatchRoleArn": {
559
- "Fn::GetAtt": [
560
- "testapigatewaylambdaLambdaRestApiCloudWatchRole6D45E039",
561
- "Arn"
562
- ]
563
- }
564
- },
565
- "DependsOn": [
566
- "testapigatewaylambdaLambdaRestApiE957E944"
567
- ]
568
- }
569
- },
570
- "Outputs": {
571
- "testapigatewaylambdaLambdaRestApiEndpoint2EF0B753": {
572
- "Value": {
573
- "Fn::Join": [
574
- "",
575
- [
576
- "https://",
577
- {
578
- "Ref": "testapigatewaylambdaLambdaRestApiE957E944"
579
- },
580
- ".execute-api.",
581
- {
582
- "Ref": "AWS::Region"
583
- },
584
- ".",
585
- {
586
- "Ref": "AWS::URLSuffix"
587
- },
588
- "/",
589
- {
590
- "Ref": "testapigatewaylambdaLambdaRestApiDeploymentStageprod4EBF7247"
591
- },
592
- "/"
593
- ]
594
- ]
595
- }
596
- }
597
- },
598
- "Parameters": {
599
- "BootstrapVersion": {
600
- "Type": "AWS::SSM::Parameter::Value<String>",
601
- "Default": "/cdk-bootstrap/hnb659fds/version",
602
- "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
603
- }
604
- },
605
- "Rules": {
606
- "CheckBootstrapVersion": {
607
- "Assertions": [
608
- {
609
- "Assert": {
610
- "Fn::Not": [
611
- {
612
- "Fn::Contains": [
613
- [
614
- "1",
615
- "2",
616
- "3",
617
- "4",
618
- "5"
619
- ],
620
- {
621
- "Ref": "BootstrapVersion"
622
- }
623
- ]
624
- }
625
- ]
626
- },
627
- "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
628
- }
629
- ]
630
- }
631
- }
632
- }