@aws-solutions-constructs/aws-cloudfront-apigateway-lambda 2.58.0 → 2.59.0

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 (21) hide show
  1. package/.jsii +5 -5
  2. package/lib/index.js +1 -1
  3. package/package.json +5 -5
  4. package/test/integ.cftaplam-customCloudfrontLoggingBucket.js.snapshot/asset.2eb6a831b107939f63cfebf68e6316e1a40f79fc99cae0fee9b333bac8d29bc4/index.js +1 -0
  5. package/test/integ.cftaplam-customCloudfrontLoggingBucket.js.snapshot/cftaplam-customCloudfrontLoggingBucket.assets.json +5 -5
  6. package/test/integ.cftaplam-customCloudfrontLoggingBucket.js.snapshot/cftaplam-customCloudfrontLoggingBucket.template.json +4 -75
  7. package/test/integ.cftaplam-customCloudfrontLoggingBucket.js.snapshot/manifest.json +10 -7
  8. package/test/integ.cftaplam-customCloudfrontLoggingBucket.js.snapshot/tree.json +79 -149
  9. package/test/integ.cftaplam-no-arguments.js.snapshot/asset.2eb6a831b107939f63cfebf68e6316e1a40f79fc99cae0fee9b333bac8d29bc4/index.js +1 -0
  10. package/test/integ.cftaplam-no-arguments.js.snapshot/cftaplam-no-arguments.assets.json +5 -5
  11. package/test/integ.cftaplam-no-arguments.js.snapshot/cftaplam-no-arguments.template.json +4 -75
  12. package/test/integ.cftaplam-no-arguments.js.snapshot/manifest.json +10 -7
  13. package/test/integ.cftaplam-no-arguments.js.snapshot/tree.json +79 -149
  14. package/test/integ.cftaplam-override-behavior.js.snapshot/asset.2eb6a831b107939f63cfebf68e6316e1a40f79fc99cae0fee9b333bac8d29bc4/index.js +1 -0
  15. package/test/integ.cftaplam-override-behavior.js.snapshot/cftaplam-override-behavior.assets.json +5 -5
  16. package/test/integ.cftaplam-override-behavior.js.snapshot/cftaplam-override-behavior.template.json +4 -75
  17. package/test/integ.cftaplam-override-behavior.js.snapshot/manifest.json +10 -7
  18. package/test/integ.cftaplam-override-behavior.js.snapshot/tree.json +84 -154
  19. package/test/integ.cftaplam-customCloudfrontLoggingBucket.js.snapshot/asset.b7f33614a69548d6bafe224d751a7ef238cde19097415e553fe8b63a4c8fd8a6/index.js +0 -1
  20. package/test/integ.cftaplam-no-arguments.js.snapshot/asset.b7f33614a69548d6bafe224d751a7ef238cde19097415e553fe8b63a4c8fd8a6/index.js +0 -1
  21. package/test/integ.cftaplam-override-behavior.js.snapshot/asset.b7f33614a69548d6bafe224d751a7ef238cde19097415e553fe8b63a4c8fd8a6/index.js +0 -1
@@ -0,0 +1 @@
1
+ "use strict";var I=Object.create,i=Object.defineProperty,C=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyNames,P=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty,B=(e,t)=>{for(var o in t)i(e,o,{get:t[o],enumerable:!0})},d=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of w(t))!A.call(e,s)&&s!==o&&i(e,s,{get:()=>t[s],enumerable:!(r=C(t,s))||r.enumerable});return e},l=(e,t,o)=>(o=e!=null?I(P(e)):{},d(t||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),L=e=>d(i({},"__esModule",{value:!0}),e),q={};B(q,{autoDeleteHandler:()=>S,handler:()=>F}),module.exports=L(q);var h=require("@aws-sdk/client-s3"),y=l(require("https")),m=l(require("url")),a={sendHttpRequest:T,log:O,includeStackTraces:!0,userHandlerIndex:"./index"},p="AWSCDK::CustomResourceProviderFramework::CREATE_FAILED",k="AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID";function R(e){return async(t,o)=>{let r={...t,ResponseURL:"..."};if(a.log(JSON.stringify(r,void 0,2)),t.RequestType==="Delete"&&t.PhysicalResourceId===p){a.log("ignoring DELETE event caused by a failed CREATE event"),await u("SUCCESS",t);return}try{let s=await e(r,o),n=D(t,s);await u("SUCCESS",n)}catch(s){let n={...t,Reason:a.includeStackTraces?s.stack:s.message};n.PhysicalResourceId||(t.RequestType==="Create"?(a.log("CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored"),n.PhysicalResourceId=p):a.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify(t)}`)),await u("FAILED",n)}}}function D(e,t={}){let o=t.PhysicalResourceId??e.PhysicalResourceId??e.RequestId;if(e.RequestType==="Delete"&&o!==e.PhysicalResourceId)throw new Error(`DELETE: cannot change the physical resource ID from "${e.PhysicalResourceId}" to "${t.PhysicalResourceId}" during deletion`);return{...e,...t,PhysicalResourceId:o}}async function u(e,t){let o={Status:e,Reason:t.Reason??e,StackId:t.StackId,RequestId:t.RequestId,PhysicalResourceId:t.PhysicalResourceId||k,LogicalResourceId:t.LogicalResourceId,NoEcho:t.NoEcho,Data:t.Data},r=m.parse(t.ResponseURL),s=`${r.protocol}//${r.hostname}/${r.pathname}?***`;a.log("submit response to cloudformation",s,o);let n=JSON.stringify(o),f={hostname:r.hostname,path:r.path,method:"PUT",headers:{"content-type":"","content-length":Buffer.byteLength(n,"utf8")}};await b({attempts:5,sleep:1e3},a.sendHttpRequest)(f,n)}async function T(e,t){return new Promise((o,r)=>{try{let s=y.request(e,n=>{n.resume(),!n.statusCode||n.statusCode>=400?r(new Error(`Unsuccessful HTTP response: ${n.statusCode}`)):o()});s.on("error",r),s.write(t),s.end()}catch(s){r(s)}})}function O(e,...t){console.log(e,...t)}function b(e,t){return async(...o)=>{let r=e.attempts,s=e.sleep;for(;;)try{return await t(...o)}catch(n){if(r--<=0)throw n;await x(Math.floor(Math.random()*s)),s*=2}}}async function x(e){return new Promise(t=>setTimeout(t,e))}var g="aws-cdk:auto-delete-objects",H=JSON.stringify({Version:"2012-10-17",Statement:[]}),c=new h.S3({}),F=R(S);async function S(e){switch(e.RequestType){case"Create":return;case"Update":return{PhysicalResourceId:(await _(e)).PhysicalResourceId};case"Delete":return W(e.ResourceProperties?.BucketName)}}async function _(e){let t=e,o=t.OldResourceProperties?.BucketName;return{PhysicalResourceId:t.ResourceProperties?.BucketName??o}}async function U(e){try{let t=(await c.getBucketPolicy({Bucket:e}))?.Policy??H,o=JSON.parse(t);o.Statement.push({Principal:"*",Effect:"Deny",Action:["s3:PutObject"],Resource:[`arn:aws:s3:::${e}/*`]}),await c.putBucketPolicy({Bucket:e,Policy:JSON.stringify(o)})}catch(t){if(t.name==="NoSuchBucket")throw t;console.log(`Could not set new object deny policy on bucket '${e}' prior to deletion.`)}}async function E(e){let t=await c.listObjectVersions({Bucket:e}),o=[...t.Versions??[],...t.DeleteMarkers??[]];if(o.length===0)return;let r=o.map(s=>({Key:s.Key,VersionId:s.VersionId}));await c.deleteObjects({Bucket:e,Delete:{Objects:r}}),t?.IsTruncated&&await E(e)}async function W(e){if(!e)throw new Error("No BucketName was provided.");try{if(!await N(e)){console.log(`Bucket does not have '${g}' tag, skipping cleaning.`);return}await U(e),await E(e)}catch(t){if(t.name==="NoSuchBucket"){console.log(`Bucket '${e}' does not exist.`);return}throw t}}async function N(e){return(await c.getBucketTagging({Bucket:e})).TagSet?.some(o=>o.Key===g&&o.Value==="true")}
@@ -14,20 +14,20 @@
14
14
  }
15
15
  }
16
16
  },
17
- "b7f33614a69548d6bafe224d751a7ef238cde19097415e553fe8b63a4c8fd8a6": {
17
+ "2eb6a831b107939f63cfebf68e6316e1a40f79fc99cae0fee9b333bac8d29bc4": {
18
18
  "source": {
19
- "path": "asset.b7f33614a69548d6bafe224d751a7ef238cde19097415e553fe8b63a4c8fd8a6",
19
+ "path": "asset.2eb6a831b107939f63cfebf68e6316e1a40f79fc99cae0fee9b333bac8d29bc4",
20
20
  "packaging": "zip"
21
21
  },
22
22
  "destinations": {
23
23
  "current_account-current_region": {
24
24
  "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
25
- "objectKey": "b7f33614a69548d6bafe224d751a7ef238cde19097415e553fe8b63a4c8fd8a6.zip",
25
+ "objectKey": "2eb6a831b107939f63cfebf68e6316e1a40f79fc99cae0fee9b333bac8d29bc4.zip",
26
26
  "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
27
27
  }
28
28
  }
29
29
  },
30
- "d3394ded72d98c0f354def63b9a4cce9cd8dbdaedbeaa9dbce6ea83bebfbd97b": {
30
+ "126b6c72d316536b4b73b1c1928345a5eb78d6d1d127a369e1b5690526ab0cb7": {
31
31
  "source": {
32
32
  "path": "cftaplam-override-behavior.template.json",
33
33
  "packaging": "file"
@@ -35,7 +35,7 @@
35
35
  "destinations": {
36
36
  "current_account-current_region": {
37
37
  "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
38
- "objectKey": "d3394ded72d98c0f354def63b9a4cce9cd8dbdaedbeaa9dbce6ea83bebfbd97b.json",
38
+ "objectKey": "126b6c72d316536b4b73b1c1928345a5eb78d6d1d127a369e1b5690526ab0cb7.json",
39
39
  "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
40
40
  }
41
41
  }
@@ -750,31 +750,18 @@
750
750
  }
751
751
  ]
752
752
  },
753
- "OwnershipControls": {
754
- "Rules": [
755
- {
756
- "ObjectOwnership": "ObjectWriter"
757
- }
758
- ]
759
- },
760
753
  "PublicAccessBlockConfiguration": {
761
754
  "BlockPublicAcls": true,
762
755
  "BlockPublicPolicy": true,
763
756
  "IgnorePublicAcls": true,
764
757
  "RestrictPublicBuckets": true
765
758
  },
766
- "Tags": [
767
- {
768
- "Key": "aws-cdk:auto-delete-objects",
769
- "Value": "true"
770
- }
771
- ],
772
759
  "VersioningConfiguration": {
773
760
  "Status": "Enabled"
774
761
  }
775
762
  },
776
- "UpdateReplacePolicy": "Delete",
777
- "DeletionPolicy": "Delete",
763
+ "UpdateReplacePolicy": "Retain",
764
+ "DeletionPolicy": "Retain",
778
765
  "Metadata": {
779
766
  "cfn_nag": {
780
767
  "rules_to_suppress": [
@@ -828,45 +815,6 @@
828
815
  }
829
816
  ]
830
817
  },
831
- {
832
- "Action": [
833
- "s3:DeleteObject*",
834
- "s3:GetBucket*",
835
- "s3:List*",
836
- "s3:PutBucketPolicy"
837
- ],
838
- "Effect": "Allow",
839
- "Principal": {
840
- "AWS": {
841
- "Fn::GetAtt": [
842
- "CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092",
843
- "Arn"
844
- ]
845
- }
846
- },
847
- "Resource": [
848
- {
849
- "Fn::GetAtt": [
850
- "cfapilambdaoverrideCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLog9CEB5CD9",
851
- "Arn"
852
- ]
853
- },
854
- {
855
- "Fn::Join": [
856
- "",
857
- [
858
- {
859
- "Fn::GetAtt": [
860
- "cfapilambdaoverrideCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLog9CEB5CD9",
861
- "Arn"
862
- ]
863
- },
864
- "/*"
865
- ]
866
- ]
867
- }
868
- ]
869
- },
870
818
  {
871
819
  "Action": "s3:PutObject",
872
820
  "Condition": {
@@ -908,25 +856,6 @@
908
856
  }
909
857
  }
910
858
  },
911
- "cfapilambdaoverrideCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLogAutoDeleteObjectsCustomResource33279C95": {
912
- "Type": "Custom::S3AutoDeleteObjects",
913
- "Properties": {
914
- "ServiceToken": {
915
- "Fn::GetAtt": [
916
- "CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F",
917
- "Arn"
918
- ]
919
- },
920
- "BucketName": {
921
- "Ref": "cfapilambdaoverrideCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLog9CEB5CD9"
922
- }
923
- },
924
- "DependsOn": [
925
- "cfapilambdaoverrideCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLogPolicy53DB42E0"
926
- ],
927
- "UpdateReplacePolicy": "Delete",
928
- "DeletionPolicy": "Delete"
929
- },
930
859
  "cfapilambdaoverrideCloudFrontToApiGatewayCloudfrontLoggingBucket3A71B9E0": {
931
860
  "Type": "AWS::S3::Bucket",
932
861
  "Properties": {
@@ -1294,7 +1223,7 @@
1294
1223
  "S3Bucket": {
1295
1224
  "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
1296
1225
  },
1297
- "S3Key": "b7f33614a69548d6bafe224d751a7ef238cde19097415e553fe8b63a4c8fd8a6.zip"
1226
+ "S3Key": "2eb6a831b107939f63cfebf68e6316e1a40f79fc99cae0fee9b333bac8d29bc4.zip"
1298
1227
  },
1299
1228
  "Timeout": 900,
1300
1229
  "MemorySize": 128,
@@ -1312,7 +1241,7 @@
1312
1241
  [
1313
1242
  "Lambda function for auto-deleting objects in ",
1314
1243
  {
1315
- "Ref": "cfapilambdaoverrideCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLog9CEB5CD9"
1244
+ "Ref": "cfapilambdaoverrideCloudFrontToApiGatewayCloudfrontLoggingBucket3A71B9E0"
1316
1245
  },
1317
1246
  " S3 bucket."
1318
1247
  ]
@@ -66,7 +66,7 @@
66
66
  "validateOnSynth": false,
67
67
  "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
68
68
  "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
69
- "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/d3394ded72d98c0f354def63b9a4cce9cd8dbdaedbeaa9dbce6ea83bebfbd97b.json",
69
+ "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/126b6c72d316536b4b73b1c1928345a5eb78d6d1d127a369e1b5690526ab0cb7.json",
70
70
  "requiresBootstrapStackVersion": 6,
71
71
  "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
72
72
  "additionalDependencies": [
@@ -238,12 +238,6 @@
238
238
  "data": "cfapilambdaoverrideCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLogPolicy53DB42E0"
239
239
  }
240
240
  ],
241
- "/cftaplam-override-behavior/cf-api-lambda-override/CloudFrontToApiGateway/CloudfrontLoggingBucketAccessLog/AutoDeleteObjectsCustomResource/Default": [
242
- {
243
- "type": "aws:cdk:logicalId",
244
- "data": "cfapilambdaoverrideCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLogAutoDeleteObjectsCustomResource33279C95"
245
- }
246
- ],
247
241
  "/cftaplam-override-behavior/cf-api-lambda-override/CloudFrontToApiGateway/CloudfrontLoggingBucket/Resource": [
248
242
  {
249
243
  "type": "aws:cdk:logicalId",
@@ -291,6 +285,15 @@
291
285
  "type": "aws:cdk:logicalId",
292
286
  "data": "CheckBootstrapVersion"
293
287
  }
288
+ ],
289
+ "cfapilambdaoverrideCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLogAutoDeleteObjectsCustomResource33279C95": [
290
+ {
291
+ "type": "aws:cdk:logicalId",
292
+ "data": "cfapilambdaoverrideCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLogAutoDeleteObjectsCustomResource33279C95",
293
+ "trace": [
294
+ "!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
295
+ ]
296
+ }
294
297
  ]
295
298
  },
296
299
  "displayName": "cftaplam-override-behavior"