@aws-solutions-constructs/aws-cloudfront-apigateway-lambda 2.58.1 → 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.
- package/.jsii +5 -5
- package/lib/index.js +1 -1
- package/package.json +5 -5
- package/test/integ.cftaplam-customCloudfrontLoggingBucket.js.snapshot/asset.2eb6a831b107939f63cfebf68e6316e1a40f79fc99cae0fee9b333bac8d29bc4/index.js +1 -0
- package/test/integ.cftaplam-customCloudfrontLoggingBucket.js.snapshot/cftaplam-customCloudfrontLoggingBucket.assets.json +5 -5
- package/test/integ.cftaplam-customCloudfrontLoggingBucket.js.snapshot/cftaplam-customCloudfrontLoggingBucket.template.json +4 -75
- package/test/integ.cftaplam-customCloudfrontLoggingBucket.js.snapshot/manifest.json +10 -7
- package/test/integ.cftaplam-customCloudfrontLoggingBucket.js.snapshot/tree.json +79 -149
- package/test/integ.cftaplam-no-arguments.js.snapshot/asset.2eb6a831b107939f63cfebf68e6316e1a40f79fc99cae0fee9b333bac8d29bc4/index.js +1 -0
- package/test/integ.cftaplam-no-arguments.js.snapshot/cftaplam-no-arguments.assets.json +5 -5
- package/test/integ.cftaplam-no-arguments.js.snapshot/cftaplam-no-arguments.template.json +4 -75
- package/test/integ.cftaplam-no-arguments.js.snapshot/manifest.json +10 -7
- package/test/integ.cftaplam-no-arguments.js.snapshot/tree.json +79 -149
- package/test/integ.cftaplam-override-behavior.js.snapshot/asset.2eb6a831b107939f63cfebf68e6316e1a40f79fc99cae0fee9b333bac8d29bc4/index.js +1 -0
- package/test/integ.cftaplam-override-behavior.js.snapshot/cftaplam-override-behavior.assets.json +5 -5
- package/test/integ.cftaplam-override-behavior.js.snapshot/cftaplam-override-behavior.template.json +4 -75
- package/test/integ.cftaplam-override-behavior.js.snapshot/manifest.json +10 -7
- package/test/integ.cftaplam-override-behavior.js.snapshot/tree.json +84 -154
- package/test/integ.cftaplam-customCloudfrontLoggingBucket.js.snapshot/asset.b7f33614a69548d6bafe224d751a7ef238cde19097415e553fe8b63a4c8fd8a6/index.js +0 -1
- package/test/integ.cftaplam-no-arguments.js.snapshot/asset.b7f33614a69548d6bafe224d751a7ef238cde19097415e553fe8b63a4c8fd8a6/index.js +0 -1
- 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
|
-
"
|
|
17
|
+
"2eb6a831b107939f63cfebf68e6316e1a40f79fc99cae0fee9b333bac8d29bc4": {
|
|
18
18
|
"source": {
|
|
19
|
-
"path": "asset.
|
|
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": "
|
|
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
|
-
"
|
|
30
|
+
"590eb76d74281a48edf9608c952776de7c3f63fa04fab3ad56cb1d6b1bbf9e7f": {
|
|
31
31
|
"source": {
|
|
32
32
|
"path": "cftaplam-no-arguments.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": "
|
|
38
|
+
"objectKey": "590eb76d74281a48edf9608c952776de7c3f63fa04fab3ad56cb1d6b1bbf9e7f.json",
|
|
39
39
|
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -769,31 +769,18 @@
|
|
|
769
769
|
}
|
|
770
770
|
]
|
|
771
771
|
},
|
|
772
|
-
"OwnershipControls": {
|
|
773
|
-
"Rules": [
|
|
774
|
-
{
|
|
775
|
-
"ObjectOwnership": "ObjectWriter"
|
|
776
|
-
}
|
|
777
|
-
]
|
|
778
|
-
},
|
|
779
772
|
"PublicAccessBlockConfiguration": {
|
|
780
773
|
"BlockPublicAcls": true,
|
|
781
774
|
"BlockPublicPolicy": true,
|
|
782
775
|
"IgnorePublicAcls": true,
|
|
783
776
|
"RestrictPublicBuckets": true
|
|
784
777
|
},
|
|
785
|
-
"Tags": [
|
|
786
|
-
{
|
|
787
|
-
"Key": "aws-cdk:auto-delete-objects",
|
|
788
|
-
"Value": "true"
|
|
789
|
-
}
|
|
790
|
-
],
|
|
791
778
|
"VersioningConfiguration": {
|
|
792
779
|
"Status": "Enabled"
|
|
793
780
|
}
|
|
794
781
|
},
|
|
795
|
-
"UpdateReplacePolicy": "
|
|
796
|
-
"DeletionPolicy": "
|
|
782
|
+
"UpdateReplacePolicy": "Retain",
|
|
783
|
+
"DeletionPolicy": "Retain",
|
|
797
784
|
"Metadata": {
|
|
798
785
|
"cfn_nag": {
|
|
799
786
|
"rules_to_suppress": [
|
|
@@ -847,45 +834,6 @@
|
|
|
847
834
|
}
|
|
848
835
|
]
|
|
849
836
|
},
|
|
850
|
-
{
|
|
851
|
-
"Action": [
|
|
852
|
-
"s3:DeleteObject*",
|
|
853
|
-
"s3:GetBucket*",
|
|
854
|
-
"s3:List*",
|
|
855
|
-
"s3:PutBucketPolicy"
|
|
856
|
-
],
|
|
857
|
-
"Effect": "Allow",
|
|
858
|
-
"Principal": {
|
|
859
|
-
"AWS": {
|
|
860
|
-
"Fn::GetAtt": [
|
|
861
|
-
"CustomS3AutoDeleteObjectsCustomResourceProviderRole3B1BD092",
|
|
862
|
-
"Arn"
|
|
863
|
-
]
|
|
864
|
-
}
|
|
865
|
-
},
|
|
866
|
-
"Resource": [
|
|
867
|
-
{
|
|
868
|
-
"Fn::GetAtt": [
|
|
869
|
-
"testcloudfrontapigatewaylambdaCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLog347EED57",
|
|
870
|
-
"Arn"
|
|
871
|
-
]
|
|
872
|
-
},
|
|
873
|
-
{
|
|
874
|
-
"Fn::Join": [
|
|
875
|
-
"",
|
|
876
|
-
[
|
|
877
|
-
{
|
|
878
|
-
"Fn::GetAtt": [
|
|
879
|
-
"testcloudfrontapigatewaylambdaCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLog347EED57",
|
|
880
|
-
"Arn"
|
|
881
|
-
]
|
|
882
|
-
},
|
|
883
|
-
"/*"
|
|
884
|
-
]
|
|
885
|
-
]
|
|
886
|
-
}
|
|
887
|
-
]
|
|
888
|
-
},
|
|
889
837
|
{
|
|
890
838
|
"Action": "s3:PutObject",
|
|
891
839
|
"Condition": {
|
|
@@ -927,25 +875,6 @@
|
|
|
927
875
|
}
|
|
928
876
|
}
|
|
929
877
|
},
|
|
930
|
-
"testcloudfrontapigatewaylambdaCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLogAutoDeleteObjectsCustomResource2395E2A2": {
|
|
931
|
-
"Type": "Custom::S3AutoDeleteObjects",
|
|
932
|
-
"Properties": {
|
|
933
|
-
"ServiceToken": {
|
|
934
|
-
"Fn::GetAtt": [
|
|
935
|
-
"CustomS3AutoDeleteObjectsCustomResourceProviderHandler9D90184F",
|
|
936
|
-
"Arn"
|
|
937
|
-
]
|
|
938
|
-
},
|
|
939
|
-
"BucketName": {
|
|
940
|
-
"Ref": "testcloudfrontapigatewaylambdaCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLog347EED57"
|
|
941
|
-
}
|
|
942
|
-
},
|
|
943
|
-
"DependsOn": [
|
|
944
|
-
"testcloudfrontapigatewaylambdaCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLogPolicy521355D8"
|
|
945
|
-
],
|
|
946
|
-
"UpdateReplacePolicy": "Delete",
|
|
947
|
-
"DeletionPolicy": "Delete"
|
|
948
|
-
},
|
|
949
878
|
"testcloudfrontapigatewaylambdaCloudFrontToApiGatewayCloudfrontLoggingBucket7F467421": {
|
|
950
879
|
"Type": "AWS::S3::Bucket",
|
|
951
880
|
"Properties": {
|
|
@@ -1235,7 +1164,7 @@
|
|
|
1235
1164
|
"S3Bucket": {
|
|
1236
1165
|
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
|
|
1237
1166
|
},
|
|
1238
|
-
"S3Key": "
|
|
1167
|
+
"S3Key": "2eb6a831b107939f63cfebf68e6316e1a40f79fc99cae0fee9b333bac8d29bc4.zip"
|
|
1239
1168
|
},
|
|
1240
1169
|
"Timeout": 900,
|
|
1241
1170
|
"MemorySize": 128,
|
|
@@ -1253,7 +1182,7 @@
|
|
|
1253
1182
|
[
|
|
1254
1183
|
"Lambda function for auto-deleting objects in ",
|
|
1255
1184
|
{
|
|
1256
|
-
"Ref": "
|
|
1185
|
+
"Ref": "testcloudfrontapigatewaylambdaCloudFrontToApiGatewayCloudfrontLoggingBucket7F467421"
|
|
1257
1186
|
},
|
|
1258
1187
|
" S3 bucket."
|
|
1259
1188
|
]
|
|
@@ -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}/
|
|
69
|
+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/590eb76d74281a48edf9608c952776de7c3f63fa04fab3ad56cb1d6b1bbf9e7f.json",
|
|
70
70
|
"requiresBootstrapStackVersion": 6,
|
|
71
71
|
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
|
|
72
72
|
"additionalDependencies": [
|
|
@@ -232,12 +232,6 @@
|
|
|
232
232
|
"data": "testcloudfrontapigatewaylambdaCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLogPolicy521355D8"
|
|
233
233
|
}
|
|
234
234
|
],
|
|
235
|
-
"/cftaplam-no-arguments/test-cloudfront-apigateway-lambda/CloudFrontToApiGateway/CloudfrontLoggingBucketAccessLog/AutoDeleteObjectsCustomResource/Default": [
|
|
236
|
-
{
|
|
237
|
-
"type": "aws:cdk:logicalId",
|
|
238
|
-
"data": "testcloudfrontapigatewaylambdaCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLogAutoDeleteObjectsCustomResource2395E2A2"
|
|
239
|
-
}
|
|
240
|
-
],
|
|
241
235
|
"/cftaplam-no-arguments/test-cloudfront-apigateway-lambda/CloudFrontToApiGateway/CloudfrontLoggingBucket/Resource": [
|
|
242
236
|
{
|
|
243
237
|
"type": "aws:cdk:logicalId",
|
|
@@ -285,6 +279,15 @@
|
|
|
285
279
|
"type": "aws:cdk:logicalId",
|
|
286
280
|
"data": "CheckBootstrapVersion"
|
|
287
281
|
}
|
|
282
|
+
],
|
|
283
|
+
"testcloudfrontapigatewaylambdaCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLogAutoDeleteObjectsCustomResource2395E2A2": [
|
|
284
|
+
{
|
|
285
|
+
"type": "aws:cdk:logicalId",
|
|
286
|
+
"data": "testcloudfrontapigatewaylambdaCloudFrontToApiGatewayCloudfrontLoggingBucketAccessLogAutoDeleteObjectsCustomResource2395E2A2",
|
|
287
|
+
"trace": [
|
|
288
|
+
"!!DESTRUCTIVE_CHANGES: WILL_DESTROY"
|
|
289
|
+
]
|
|
290
|
+
}
|
|
288
291
|
]
|
|
289
292
|
},
|
|
290
293
|
"displayName": "cftaplam-no-arguments"
|