@gradientedge/cdk-utils 8.118.0 → 8.120.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/app/api-destined-function/package.json +1 -1
- package/dist/src/lib/common/construct.d.ts +32 -32
- package/dist/src/lib/common/construct.js +36 -59
- package/dist/src/lib/common/stack.d.ts +8 -7
- package/dist/src/lib/common/stack.js +17 -37
- package/dist/src/lib/common/types.d.ts +2 -2
- package/dist/src/lib/construct/api-to-eventbridge-target/api.d.ts +22 -22
- package/dist/src/lib/construct/api-to-eventbridge-target/event.d.ts +9 -9
- package/dist/src/lib/construct/api-to-eventbridge-target/main.d.ts +3 -3
- package/dist/src/lib/construct/api-to-eventbridge-target/main.js +37 -60
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.d.ts +9 -9
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.d.ts +3 -3
- package/dist/src/lib/construct/api-to-eventbridge-target-with-sns/main.js +40 -63
- package/dist/src/lib/construct/api-to-lambda-target/api.d.ts +23 -23
- package/dist/src/lib/construct/api-to-lambda-target/main.d.ts +2 -2
- package/dist/src/lib/construct/api-to-lambda-target/main.js +15 -38
- package/dist/src/lib/construct/application-configuration/main.d.ts +7 -7
- package/dist/src/lib/construct/application-configuration/main.js +17 -41
- package/dist/src/lib/construct/graphql-api-lambda/main.d.ts +17 -17
- package/dist/src/lib/construct/graphql-api-lambda/main.js +6 -29
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.d.ts +5 -5
- package/dist/src/lib/construct/graphql-api-lambda-with-cache/main.js +7 -7
- package/dist/src/lib/construct/lambda-with-iam-access/main.d.ts +16 -16
- package/dist/src/lib/construct/lambda-with-iam-access/main.js +8 -31
- package/dist/src/lib/construct/lambda-with-iam-access/types.d.ts +4 -4
- package/dist/src/lib/construct/rest-api-lambda/main.d.ts +16 -16
- package/dist/src/lib/construct/rest-api-lambda/main.js +5 -28
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.d.ts +5 -5
- package/dist/src/lib/construct/rest-api-lambda-with-cache/main.js +9 -32
- package/dist/src/lib/construct/site-with-ecs-backend/main.d.ts +38 -39
- package/dist/src/lib/construct/site-with-ecs-backend/main.js +33 -54
- package/dist/src/lib/construct/static-asset-deployment/main.d.ts +4 -4
- package/dist/src/lib/construct/static-asset-deployment/main.js +3 -26
- package/dist/src/lib/construct/static-site/main.d.ts +15 -15
- package/dist/src/lib/construct/static-site/main.js +4 -27
- package/dist/src/lib/services/{aws/api-gateway → api-gateway}/main.d.ts +10 -10
- package/dist/src/lib/services/{aws/api-gateway → api-gateway}/main.js +21 -44
- package/dist/src/lib/services/api-gateway/types.d.ts +7 -0
- package/dist/src/lib/services/{aws/appconfig → appconfig}/main.d.ts +7 -7
- package/dist/src/lib/services/{aws/appconfig → appconfig}/main.js +14 -37
- package/dist/src/lib/services/{aws/certificate-manager → certificate-manager}/main.d.ts +5 -5
- package/dist/src/lib/services/{aws/certificate-manager → certificate-manager}/main.js +10 -33
- package/dist/src/lib/services/{aws/certificate-manager → certificate-manager}/types.d.ts +2 -2
- package/dist/src/lib/services/{aws/cloudfront → cloudfront}/main.d.ts +19 -19
- package/dist/src/lib/services/{aws/cloudfront → cloudfront}/main.js +47 -46
- package/dist/src/lib/services/{aws/cloudfront → cloudfront}/types.d.ts +3 -4
- package/dist/src/lib/services/{aws/cloudtrail → cloudtrail}/main.d.ts +6 -6
- package/dist/src/lib/services/{aws/cloudtrail → cloudtrail}/main.js +5 -28
- package/dist/src/lib/services/{aws/cloudwatch → cloudwatch}/logs.d.ts +1 -1
- package/dist/src/lib/services/{aws/cloudwatch → cloudwatch}/logs.js +1 -1
- package/dist/src/lib/services/{aws/cloudwatch → cloudwatch}/main.d.ts +1 -1
- package/dist/src/lib/services/{aws/cloudwatch → cloudwatch}/main.js +1 -1
- package/dist/src/lib/services/{aws/cloudwatch → cloudwatch}/types.d.ts +1 -1
- package/dist/src/lib/services/{aws/codebuild → codebuild}/main.d.ts +4 -4
- package/dist/src/lib/services/{aws/codebuild → codebuild}/main.js +7 -30
- package/dist/src/lib/services/{aws/dynamodb → dynamodb}/main.d.ts +4 -4
- package/dist/src/lib/services/{aws/dynamodb → dynamodb}/main.js +8 -31
- package/dist/src/lib/services/{aws/dynamodb → dynamodb}/types.d.ts +1 -1
- package/dist/src/lib/services/{aws/elastic-container-registry → elastic-container-registry}/main.d.ts +3 -3
- package/dist/src/lib/services/elastic-container-registry/main.js +37 -0
- package/dist/src/lib/services/{aws/elastic-container-service → elastic-container-service}/main.d.ts +11 -11
- package/dist/src/lib/services/{aws/elastic-container-service → elastic-container-service}/main.js +27 -50
- package/dist/src/lib/services/{aws/elastic-container-service → elastic-container-service}/types.d.ts +4 -4
- package/dist/src/lib/services/{aws/elastic-file-system → elastic-file-system}/main.d.ts +4 -4
- package/dist/src/lib/services/{aws/elastic-file-system → elastic-file-system}/main.js +12 -35
- package/dist/src/lib/services/{aws/elastic-kubernetes-service → elastic-kubernetes-service}/main.d.ts +5 -5
- package/dist/src/lib/services/{aws/elastic-kubernetes-service → elastic-kubernetes-service}/main.js +8 -31
- package/dist/src/lib/services/{aws/elasticache → elasticache}/main.d.ts +5 -5
- package/dist/src/lib/services/{aws/elasticache → elasticache}/main.js +10 -33
- package/dist/src/lib/services/{aws/eventbridge → eventbridge}/main.d.ts +14 -14
- package/dist/src/lib/services/{aws/eventbridge → eventbridge}/main.js +26 -49
- package/dist/src/lib/services/{aws/eventbridge → eventbridge}/target.d.ts +11 -11
- package/dist/src/lib/services/{aws/eventbridge → eventbridge}/target.js +6 -29
- package/dist/src/lib/services/{aws/eventbridge → eventbridge}/types.d.ts +1 -1
- package/dist/src/lib/services/{aws/evidently → evidently}/main.d.ts +8 -8
- package/dist/src/lib/services/{aws/evidently → evidently}/main.js +18 -41
- package/dist/src/lib/services/{aws/identity-access-management → identity-access-management}/main.d.ts +49 -50
- package/dist/src/lib/services/{aws/identity-access-management → identity-access-management}/main.js +110 -133
- package/dist/src/lib/services/index.d.ts +28 -1
- package/dist/src/lib/services/index.js +28 -1
- package/dist/src/lib/services/{aws/key-management-service → key-management-service}/main.d.ts +3 -3
- package/dist/src/lib/services/{aws/key-management-service → key-management-service}/main.js +5 -28
- package/dist/src/lib/services/{aws/lambda → lambda}/main.d.ts +12 -14
- package/dist/src/lib/services/{aws/lambda → lambda}/main.js +32 -59
- package/dist/src/lib/services/{aws/lambda → lambda}/types.d.ts +1 -1
- package/dist/src/lib/services/{aws/route53 → route53}/main.d.ts +10 -10
- package/dist/src/lib/services/{aws/route53 → route53}/main.js +21 -44
- package/dist/src/lib/services/{aws/secrets-manager → secrets-manager}/main.d.ts +6 -7
- package/dist/src/lib/services/{aws/secrets-manager → secrets-manager}/main.js +10 -33
- package/dist/src/lib/services/{aws/simple-notification-service → simple-notification-service}/main.d.ts +5 -5
- package/dist/src/lib/services/{aws/simple-notification-service → simple-notification-service}/main.js +11 -34
- package/dist/src/lib/services/{aws/simple-queue-service → simple-queue-service}/main.d.ts +7 -8
- package/dist/src/lib/services/{aws/simple-queue-service → simple-queue-service}/main.js +15 -38
- package/dist/src/lib/services/{aws/simple-queue-service → simple-queue-service}/types.d.ts +1 -1
- package/dist/src/lib/services/{aws/simple-storage-service → simple-storage-service}/main.d.ts +10 -11
- package/dist/src/lib/services/{aws/simple-storage-service → simple-storage-service}/main.js +31 -54
- package/dist/src/lib/services/{aws/simple-storage-service → simple-storage-service}/types.d.ts +1 -1
- package/dist/src/lib/services/{aws/step-function → step-function}/main.d.ts +32 -33
- package/dist/src/lib/services/{aws/step-function → step-function}/main.js +33 -57
- package/dist/src/lib/services/{aws/systems-manager → systems-manager}/main.d.ts +5 -5
- package/dist/src/lib/services/{aws/systems-manager → systems-manager}/main.js +10 -33
- package/dist/src/lib/services/{aws/virtual-private-cloud → virtual-private-cloud}/main.d.ts +6 -7
- package/dist/src/lib/services/virtual-private-cloud/main.js +70 -0
- package/dist/src/lib/services/{aws/web-application-firewall → web-application-firewall}/main.d.ts +4 -4
- package/dist/src/lib/services/{aws/web-application-firewall → web-application-firewall}/main.js +8 -31
- package/dist/src/lib/utils/aws/index.d.ts +6 -3
- package/dist/src/lib/utils/aws/index.js +9 -26
- package/package.json +15 -15
- package/src/lib/common/construct.ts +97 -67
- package/src/lib/common/stack.ts +12 -12
- package/src/lib/common/types.ts +2 -2
- package/src/lib/construct/api-to-eventbridge-target/api.ts +31 -22
- package/src/lib/construct/api-to-eventbridge-target/event.ts +9 -9
- package/src/lib/construct/api-to-eventbridge-target/main.ts +56 -41
- package/src/lib/construct/api-to-eventbridge-target-with-sns/api-destined-lambda.ts +9 -9
- package/src/lib/construct/api-to-eventbridge-target-with-sns/main.ts +62 -47
- package/src/lib/construct/api-to-lambda-target/api.ts +33 -23
- package/src/lib/construct/api-to-lambda-target/main.ts +24 -18
- package/src/lib/construct/application-configuration/main.ts +31 -24
- package/src/lib/construct/graphql-api-lambda/main.ts +22 -22
- package/src/lib/construct/graphql-api-lambda-with-cache/main.ts +13 -13
- package/src/lib/construct/lambda-with-iam-access/main.ts +25 -25
- package/src/lib/construct/lambda-with-iam-access/types.ts +4 -4
- package/src/lib/construct/rest-api-lambda/main.ts +21 -21
- package/src/lib/construct/rest-api-lambda-with-cache/main.ts +14 -14
- package/src/lib/construct/site-with-ecs-backend/main.ts +79 -60
- package/src/lib/construct/static-asset-deployment/main.ts +6 -6
- package/src/lib/construct/static-site/main.ts +23 -17
- package/src/lib/services/{aws/api-gateway → api-gateway}/main.ts +42 -36
- package/src/lib/services/api-gateway/types.ts +8 -0
- package/src/lib/services/{aws/appconfig → appconfig}/main.ts +19 -19
- package/src/lib/services/{aws/certificate-manager → certificate-manager}/main.ts +14 -14
- package/src/lib/services/{aws/certificate-manager → certificate-manager}/types.ts +2 -2
- package/src/lib/services/{aws/cloudfront → cloudfront}/main.ts +89 -75
- package/src/lib/services/{aws/cloudfront → cloudfront}/types.ts +7 -4
- package/src/lib/services/{aws/cloudtrail → cloudtrail}/main.ts +12 -12
- package/src/lib/services/{aws/cloudwatch → cloudwatch}/logs.ts +2 -2
- package/src/lib/services/{aws/cloudwatch → cloudwatch}/main.ts +2 -2
- package/src/lib/services/{aws/cloudwatch → cloudwatch}/types.ts +1 -1
- package/src/lib/services/{aws/codebuild → codebuild}/main.ts +8 -8
- package/src/lib/services/{aws/dynamodb → dynamodb}/main.ts +9 -9
- package/src/lib/services/{aws/dynamodb → dynamodb}/types.ts +1 -1
- package/src/lib/services/{aws/elastic-container-registry → elastic-container-registry}/main.ts +5 -5
- package/src/lib/services/{aws/elastic-container-service → elastic-container-service}/main.ts +49 -38
- package/src/lib/services/{aws/elastic-container-service → elastic-container-service}/types.ts +4 -4
- package/src/lib/services/{aws/elastic-file-system → elastic-file-system}/main.ts +17 -17
- package/src/lib/services/{aws/elastic-kubernetes-service → elastic-kubernetes-service}/main.ts +12 -12
- package/src/lib/services/{aws/elasticache → elasticache}/main.ts +11 -11
- package/src/lib/services/{aws/eventbridge → eventbridge}/main.ts +38 -38
- package/src/lib/services/{aws/eventbridge → eventbridge}/target.ts +15 -15
- package/src/lib/services/{aws/eventbridge → eventbridge}/types.ts +1 -1
- package/src/lib/services/{aws/evidently → evidently}/main.ts +19 -19
- package/src/lib/services/{aws/identity-access-management → identity-access-management}/main.ts +143 -135
- package/src/lib/services/index.ts +28 -1
- package/src/lib/services/{aws/key-management-service → key-management-service}/main.ts +6 -6
- package/src/lib/services/{aws/lambda → lambda}/main.ts +66 -60
- package/src/lib/services/{aws/lambda → lambda}/types.ts +1 -1
- package/src/lib/services/{aws/route53 → route53}/main.ts +32 -32
- package/src/lib/services/{aws/secrets-manager → secrets-manager}/main.ts +12 -16
- package/src/lib/services/{aws/simple-notification-service → simple-notification-service}/main.ts +14 -14
- package/src/lib/services/{aws/simple-queue-service → simple-queue-service}/main.ts +19 -19
- package/src/lib/services/{aws/simple-queue-service → simple-queue-service}/types.ts +1 -1
- package/src/lib/services/{aws/simple-storage-service → simple-storage-service}/main.ts +40 -40
- package/src/lib/services/{aws/simple-storage-service → simple-storage-service}/types.ts +1 -1
- package/src/lib/services/{aws/step-function → step-function}/main.ts +78 -66
- package/src/lib/services/{aws/systems-manager → systems-manager}/main.ts +18 -13
- package/src/lib/services/{aws/virtual-private-cloud → virtual-private-cloud}/main.ts +17 -17
- package/src/lib/services/{aws/web-application-firewall → web-application-firewall}/main.ts +9 -9
- package/src/lib/utils/aws/index.ts +8 -5
- package/dist/src/lib/services/aws/api-gateway/types.d.ts +0 -7
- package/dist/src/lib/services/aws/elastic-container-registry/main.js +0 -60
- package/dist/src/lib/services/aws/index.d.ts +0 -28
- package/dist/src/lib/services/aws/index.js +0 -44
- package/dist/src/lib/services/aws/virtual-private-cloud/main.js +0 -93
- package/src/lib/services/aws/api-gateway/types.ts +0 -8
- package/src/lib/services/aws/index.ts +0 -28
- /package/dist/src/lib/services/{aws/api-gateway → api-gateway}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/api-gateway → api-gateway}/index.js +0 -0
- /package/dist/src/lib/services/{aws/api-gateway → api-gateway}/types.js +0 -0
- /package/dist/src/lib/services/{aws/appconfig → appconfig}/constants.d.ts +0 -0
- /package/dist/src/lib/services/{aws/appconfig → appconfig}/constants.js +0 -0
- /package/dist/src/lib/services/{aws/appconfig → appconfig}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/appconfig → appconfig}/index.js +0 -0
- /package/dist/src/lib/services/{aws/appconfig → appconfig}/types.d.ts +0 -0
- /package/dist/src/lib/services/{aws/appconfig → appconfig}/types.js +0 -0
- /package/dist/src/lib/services/{aws/certificate-manager → certificate-manager}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/certificate-manager → certificate-manager}/index.js +0 -0
- /package/dist/src/lib/services/{aws/certificate-manager → certificate-manager}/types.js +0 -0
- /package/dist/src/lib/services/{aws/cloudfront → cloudfront}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/cloudfront → cloudfront}/index.js +0 -0
- /package/dist/src/lib/services/{aws/cloudfront → cloudfront}/types.js +0 -0
- /package/dist/src/lib/services/{aws/cloudtrail → cloudtrail}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/cloudtrail → cloudtrail}/index.js +0 -0
- /package/dist/src/lib/services/{aws/cloudtrail → cloudtrail}/types.d.ts +0 -0
- /package/dist/src/lib/services/{aws/cloudtrail → cloudtrail}/types.js +0 -0
- /package/dist/src/lib/services/{aws/cloudwatch → cloudwatch}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/cloudwatch → cloudwatch}/index.js +0 -0
- /package/dist/src/lib/services/{aws/cloudwatch → cloudwatch}/types.js +0 -0
- /package/dist/src/lib/services/{aws/codebuild → codebuild}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/codebuild → codebuild}/index.js +0 -0
- /package/dist/src/lib/services/{aws/constants.d.ts → constants.d.ts} +0 -0
- /package/dist/src/lib/services/{aws/constants.js → constants.js} +0 -0
- /package/dist/src/lib/services/{aws/dynamodb → dynamodb}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/dynamodb → dynamodb}/index.js +0 -0
- /package/dist/src/lib/services/{aws/dynamodb → dynamodb}/types.js +0 -0
- /package/dist/src/lib/services/{aws/elastic-container-registry → elastic-container-registry}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/elastic-container-registry → elastic-container-registry}/index.js +0 -0
- /package/dist/src/lib/services/{aws/elastic-container-service → elastic-container-service}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/elastic-container-service → elastic-container-service}/index.js +0 -0
- /package/dist/src/lib/services/{aws/elastic-container-service → elastic-container-service}/types.js +0 -0
- /package/dist/src/lib/services/{aws/elastic-file-system → elastic-file-system}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/elastic-file-system → elastic-file-system}/index.js +0 -0
- /package/dist/src/lib/services/{aws/elastic-file-system → elastic-file-system}/types.d.ts +0 -0
- /package/dist/src/lib/services/{aws/elastic-file-system → elastic-file-system}/types.js +0 -0
- /package/dist/src/lib/services/{aws/elastic-kubernetes-service → elastic-kubernetes-service}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/elastic-kubernetes-service → elastic-kubernetes-service}/index.js +0 -0
- /package/dist/src/lib/services/{aws/elastic-kubernetes-service → elastic-kubernetes-service}/types.d.ts +0 -0
- /package/dist/src/lib/services/{aws/elastic-kubernetes-service → elastic-kubernetes-service}/types.js +0 -0
- /package/dist/src/lib/services/{aws/elasticache → elasticache}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/elasticache → elasticache}/index.js +0 -0
- /package/dist/src/lib/services/{aws/elasticache → elasticache}/types.d.ts +0 -0
- /package/dist/src/lib/services/{aws/elasticache → elasticache}/types.js +0 -0
- /package/dist/src/lib/services/{aws/eventbridge → eventbridge}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/eventbridge → eventbridge}/index.js +0 -0
- /package/dist/src/lib/services/{aws/eventbridge → eventbridge}/types.js +0 -0
- /package/dist/src/lib/services/{aws/evidently → evidently}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/evidently → evidently}/index.js +0 -0
- /package/dist/src/lib/services/{aws/evidently → evidently}/types.d.ts +0 -0
- /package/dist/src/lib/services/{aws/evidently → evidently}/types.js +0 -0
- /package/dist/src/lib/services/{aws/identity-access-management → identity-access-management}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/identity-access-management → identity-access-management}/index.js +0 -0
- /package/dist/src/lib/services/{aws/key-management-service → key-management-service}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/key-management-service → key-management-service}/index.js +0 -0
- /package/dist/src/lib/services/{aws/key-management-service → key-management-service}/types.d.ts +0 -0
- /package/dist/src/lib/services/{aws/key-management-service → key-management-service}/types.js +0 -0
- /package/dist/src/lib/services/{aws/lambda → lambda}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/lambda → lambda}/index.js +0 -0
- /package/dist/src/lib/services/{aws/lambda → lambda}/types.js +0 -0
- /package/dist/src/lib/services/{aws/route53 → route53}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/route53 → route53}/index.js +0 -0
- /package/dist/src/lib/services/{aws/route53 → route53}/types.d.ts +0 -0
- /package/dist/src/lib/services/{aws/route53 → route53}/types.js +0 -0
- /package/dist/src/lib/services/{aws/secrets-manager → secrets-manager}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/secrets-manager → secrets-manager}/index.js +0 -0
- /package/dist/src/lib/services/{aws/simple-notification-service → simple-notification-service}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/simple-notification-service → simple-notification-service}/index.js +0 -0
- /package/dist/src/lib/services/{aws/simple-notification-service → simple-notification-service}/types.d.ts +0 -0
- /package/dist/src/lib/services/{aws/simple-notification-service → simple-notification-service}/types.js +0 -0
- /package/dist/src/lib/services/{aws/simple-queue-service → simple-queue-service}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/simple-queue-service → simple-queue-service}/index.js +0 -0
- /package/dist/src/lib/services/{aws/simple-queue-service → simple-queue-service}/types.js +0 -0
- /package/dist/src/lib/services/{aws/simple-storage-service → simple-storage-service}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/simple-storage-service → simple-storage-service}/index.js +0 -0
- /package/dist/src/lib/services/{aws/simple-storage-service → simple-storage-service}/types.js +0 -0
- /package/dist/src/lib/services/{aws/step-function → step-function}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/step-function → step-function}/index.js +0 -0
- /package/dist/src/lib/services/{aws/step-function → step-function}/types.d.ts +0 -0
- /package/dist/src/lib/services/{aws/step-function → step-function}/types.js +0 -0
- /package/dist/src/lib/services/{aws/systems-manager → systems-manager}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/systems-manager → systems-manager}/index.js +0 -0
- /package/dist/src/lib/services/{aws/systems-manager → systems-manager}/types.d.ts +0 -0
- /package/dist/src/lib/services/{aws/systems-manager → systems-manager}/types.js +0 -0
- /package/dist/src/lib/services/{aws/virtual-private-cloud → virtual-private-cloud}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/virtual-private-cloud → virtual-private-cloud}/index.js +0 -0
- /package/dist/src/lib/services/{aws/web-application-firewall → web-application-firewall}/index.d.ts +0 -0
- /package/dist/src/lib/services/{aws/web-application-firewall → web-application-firewall}/index.js +0 -0
- /package/dist/src/lib/services/{aws/web-application-firewall → web-application-firewall}/types.d.ts +0 -0
- /package/dist/src/lib/services/{aws/web-application-firewall → web-application-firewall}/types.js +0 -0
- /package/src/lib/services/{aws/api-gateway → api-gateway}/index.ts +0 -0
- /package/src/lib/services/{aws/appconfig → appconfig}/constants.ts +0 -0
- /package/src/lib/services/{aws/appconfig → appconfig}/index.ts +0 -0
- /package/src/lib/services/{aws/appconfig → appconfig}/types.ts +0 -0
- /package/src/lib/services/{aws/certificate-manager → certificate-manager}/index.ts +0 -0
- /package/src/lib/services/{aws/cloudfront → cloudfront}/index.ts +0 -0
- /package/src/lib/services/{aws/cloudtrail → cloudtrail}/index.ts +0 -0
- /package/src/lib/services/{aws/cloudtrail → cloudtrail}/types.ts +0 -0
- /package/src/lib/services/{aws/cloudwatch → cloudwatch}/index.ts +0 -0
- /package/src/lib/services/{aws/codebuild → codebuild}/index.ts +0 -0
- /package/src/lib/services/{aws/constants.ts → constants.ts} +0 -0
- /package/src/lib/services/{aws/dynamodb → dynamodb}/index.ts +0 -0
- /package/src/lib/services/{aws/elastic-container-registry → elastic-container-registry}/index.ts +0 -0
- /package/src/lib/services/{aws/elastic-container-service → elastic-container-service}/index.ts +0 -0
- /package/src/lib/services/{aws/elastic-file-system → elastic-file-system}/index.ts +0 -0
- /package/src/lib/services/{aws/elastic-file-system → elastic-file-system}/types.ts +0 -0
- /package/src/lib/services/{aws/elastic-kubernetes-service → elastic-kubernetes-service}/index.ts +0 -0
- /package/src/lib/services/{aws/elastic-kubernetes-service → elastic-kubernetes-service}/types.ts +0 -0
- /package/src/lib/services/{aws/elasticache → elasticache}/index.ts +0 -0
- /package/src/lib/services/{aws/elasticache → elasticache}/types.ts +0 -0
- /package/src/lib/services/{aws/eventbridge → eventbridge}/index.ts +0 -0
- /package/src/lib/services/{aws/evidently → evidently}/index.ts +0 -0
- /package/src/lib/services/{aws/evidently → evidently}/types.ts +0 -0
- /package/src/lib/services/{aws/identity-access-management → identity-access-management}/index.ts +0 -0
- /package/src/lib/services/{aws/key-management-service → key-management-service}/index.ts +0 -0
- /package/src/lib/services/{aws/key-management-service → key-management-service}/types.ts +0 -0
- /package/src/lib/services/{aws/lambda → lambda}/index.ts +0 -0
- /package/src/lib/services/{aws/route53 → route53}/index.ts +0 -0
- /package/src/lib/services/{aws/route53 → route53}/types.ts +0 -0
- /package/src/lib/services/{aws/secrets-manager → secrets-manager}/index.ts +0 -0
- /package/src/lib/services/{aws/simple-notification-service → simple-notification-service}/index.ts +0 -0
- /package/src/lib/services/{aws/simple-notification-service → simple-notification-service}/types.ts +0 -0
- /package/src/lib/services/{aws/simple-queue-service → simple-queue-service}/index.ts +0 -0
- /package/src/lib/services/{aws/simple-storage-service → simple-storage-service}/index.ts +0 -0
- /package/src/lib/services/{aws/step-function → step-function}/index.ts +0 -0
- /package/src/lib/services/{aws/step-function → step-function}/types.ts +0 -0
- /package/src/lib/services/{aws/systems-manager → systems-manager}/index.ts +0 -0
- /package/src/lib/services/{aws/systems-manager → systems-manager}/types.ts +0 -0
- /package/src/lib/services/{aws/virtual-private-cloud → virtual-private-cloud}/index.ts +0 -0
- /package/src/lib/services/{aws/web-application-firewall → web-application-firewall}/index.ts +0 -0
- /package/src/lib/services/{aws/web-application-firewall → web-application-firewall}/types.ts +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { Fn } from 'aws-cdk-lib'
|
|
2
|
+
import { ISecurityGroup, IVpc, Peer, Port, SecurityGroup } from 'aws-cdk-lib/aws-ec2'
|
|
3
|
+
import { CfnReplicationGroup } from 'aws-cdk-lib/aws-elasticache'
|
|
4
|
+
import { ManagedPolicy } from 'aws-cdk-lib/aws-iam'
|
|
5
5
|
import { Construct } from 'constructs'
|
|
6
6
|
import { RestApiLambda } from '..'
|
|
7
|
+
import { createCfnOutput } from '../../utils'
|
|
7
8
|
import { RestApiLambdaWithCacheProps } from './types'
|
|
8
|
-
import * as utils from '../../utils'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @classdesc Provides a construct to create and deploy a RestApi API as Lambda with Caching
|
|
@@ -30,9 +30,9 @@ export abstract class RestApiLambdaWithCache extends RestApiLambda {
|
|
|
30
30
|
id: string
|
|
31
31
|
|
|
32
32
|
/* restApiLambda resources */
|
|
33
|
-
restApivpc:
|
|
34
|
-
restApiCache:
|
|
35
|
-
restApiSecurityGroup:
|
|
33
|
+
restApivpc: IVpc
|
|
34
|
+
restApiCache: CfnReplicationGroup
|
|
35
|
+
restApiSecurityGroup: ISecurityGroup
|
|
36
36
|
restApiSecurityGroupExportName: string
|
|
37
37
|
|
|
38
38
|
protected constructor(parent: Construct, id: string, props: RestApiLambdaWithCacheProps) {
|
|
@@ -65,20 +65,20 @@ export abstract class RestApiLambdaWithCache extends RestApiLambda {
|
|
|
65
65
|
*/
|
|
66
66
|
protected resolveSecurityGroup() {
|
|
67
67
|
if (this.props.securityGroupExportName) {
|
|
68
|
-
this.restApiSecurityGroup =
|
|
68
|
+
this.restApiSecurityGroup = SecurityGroup.fromSecurityGroupId(
|
|
69
69
|
this,
|
|
70
70
|
`${this.id}-security-group`,
|
|
71
|
-
|
|
71
|
+
Fn.importValue(this.props.securityGroupExportName)
|
|
72
72
|
)
|
|
73
73
|
} else {
|
|
74
|
-
this.restApiSecurityGroup = new
|
|
74
|
+
this.restApiSecurityGroup = new SecurityGroup(this, `${this.id}-security-group-${this.props.stage}`, {
|
|
75
75
|
securityGroupName: `${this.id}-security-group-${this.props.stage}`,
|
|
76
76
|
vpc: this.restApivpc,
|
|
77
77
|
})
|
|
78
78
|
|
|
79
|
-
this.restApiSecurityGroup.addIngressRule(
|
|
79
|
+
this.restApiSecurityGroup.addIngressRule(Peer.anyIpv4(), Port.allTraffic(), 'All Traffic')
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
createCfnOutput(`${this.id}-security-group-id`, this, this.restApiSecurityGroup.securityGroupId)
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -118,7 +118,7 @@ export abstract class RestApiLambdaWithCache extends RestApiLambda {
|
|
|
118
118
|
super.createLambdaRole()
|
|
119
119
|
|
|
120
120
|
this.restApiLambdaRole.addManagedPolicy(
|
|
121
|
-
|
|
121
|
+
ManagedPolicy.fromAwsManagedPolicyName('service-role/AWSLambdaVPCAccessExecutionRole')
|
|
122
122
|
)
|
|
123
123
|
}
|
|
124
124
|
|
|
@@ -1,20 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import
|
|
14
|
-
import
|
|
1
|
+
import { Duration } from 'aws-cdk-lib'
|
|
2
|
+
import { ICertificate } from 'aws-cdk-lib/aws-certificatemanager'
|
|
3
|
+
import {
|
|
4
|
+
CachePolicy,
|
|
5
|
+
Distribution,
|
|
6
|
+
FunctionAssociation,
|
|
7
|
+
FunctionEventType,
|
|
8
|
+
IFunction,
|
|
9
|
+
OriginProtocolPolicy,
|
|
10
|
+
OriginRequestPolicy,
|
|
11
|
+
ResponseHeadersPolicy,
|
|
12
|
+
} from 'aws-cdk-lib/aws-cloudfront'
|
|
13
|
+
import { HttpOrigin } from 'aws-cdk-lib/aws-cloudfront-origins'
|
|
14
|
+
import { IVpc } from 'aws-cdk-lib/aws-ec2'
|
|
15
|
+
import {
|
|
16
|
+
AssetImage,
|
|
17
|
+
Cluster,
|
|
18
|
+
ContainerImage,
|
|
19
|
+
FargateService,
|
|
20
|
+
FargateTaskDefinition,
|
|
21
|
+
LogDriver,
|
|
22
|
+
} from 'aws-cdk-lib/aws-ecs'
|
|
23
|
+
import { ApplicationLoadBalancedFargateService } from 'aws-cdk-lib/aws-ecs-patterns'
|
|
24
|
+
import { FileSystem } from 'aws-cdk-lib/aws-efs'
|
|
25
|
+
import {
|
|
26
|
+
ApplicationListener,
|
|
27
|
+
ApplicationLoadBalancer,
|
|
28
|
+
ApplicationTargetGroup,
|
|
29
|
+
} from 'aws-cdk-lib/aws-elasticloadbalancingv2'
|
|
30
|
+
import { PolicyDocument, PolicyStatement, Role } from 'aws-cdk-lib/aws-iam'
|
|
31
|
+
import { LogGroup } from 'aws-cdk-lib/aws-logs'
|
|
32
|
+
import { IHostedZone } from 'aws-cdk-lib/aws-route53'
|
|
33
|
+
import { IBucket } from 'aws-cdk-lib/aws-s3'
|
|
15
34
|
import { Construct } from 'constructs'
|
|
35
|
+
import _ from 'lodash'
|
|
16
36
|
import { CommonConstruct } from '../../common'
|
|
17
|
-
import {
|
|
37
|
+
import { SiteCachePolicyProps, SiteResponseHeadersPolicyProps, SiteWithEcsBackendProps } from './types'
|
|
18
38
|
|
|
19
39
|
/**
|
|
20
40
|
* @classdesc Provides a construct to create and deploy a site hosted with an clustered ECS/ELB backend
|
|
@@ -37,35 +57,35 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
37
57
|
id: string
|
|
38
58
|
|
|
39
59
|
/* site resources */
|
|
40
|
-
siteHostedZone:
|
|
41
|
-
siteCertificate:
|
|
42
|
-
siteRegionalCertificate:
|
|
43
|
-
siteEcsPolicy:
|
|
44
|
-
siteEcsRole:
|
|
60
|
+
siteHostedZone: IHostedZone
|
|
61
|
+
siteCertificate: ICertificate
|
|
62
|
+
siteRegionalCertificate: ICertificate
|
|
63
|
+
siteEcsPolicy: PolicyDocument
|
|
64
|
+
siteEcsRole: Role
|
|
45
65
|
siteEcsEnvironment: { [key: string]: string }
|
|
46
|
-
siteVpc:
|
|
66
|
+
siteVpc: IVpc
|
|
47
67
|
siteSecrets: any
|
|
48
|
-
siteEcsCluster:
|
|
49
|
-
siteEcsLogGroup:
|
|
68
|
+
siteEcsCluster: Cluster
|
|
69
|
+
siteEcsLogGroup: LogGroup
|
|
50
70
|
siteEcsBuildArgs: any = {}
|
|
51
|
-
siteEcsContainerImage:
|
|
52
|
-
siteEcsService:
|
|
53
|
-
siteEcsTaskDefinition:
|
|
54
|
-
siteEcsListener:
|
|
55
|
-
siteEcsLoadBalancer:
|
|
56
|
-
siteEcsTargetGroup:
|
|
57
|
-
siteFileSystem:
|
|
58
|
-
siteLogBucket:
|
|
59
|
-
siteOrigin:
|
|
60
|
-
siteDistribution:
|
|
71
|
+
siteEcsContainerImage: AssetImage
|
|
72
|
+
siteEcsService: FargateService
|
|
73
|
+
siteEcsTaskDefinition: FargateTaskDefinition
|
|
74
|
+
siteEcsListener: ApplicationListener
|
|
75
|
+
siteEcsLoadBalancer: ApplicationLoadBalancer
|
|
76
|
+
siteEcsTargetGroup: ApplicationTargetGroup
|
|
77
|
+
siteFileSystem: FileSystem
|
|
78
|
+
siteLogBucket: IBucket
|
|
79
|
+
siteOrigin: HttpOrigin
|
|
80
|
+
siteDistribution: Distribution
|
|
61
81
|
siteInternalDomainName: string
|
|
62
82
|
siteExternalDomainName: string
|
|
63
83
|
siteDomainNames: string[]
|
|
64
|
-
siteCloudfrontFunction:
|
|
65
|
-
siteFunctionAssociations:
|
|
66
|
-
siteOriginRequestPolicy:
|
|
67
|
-
siteOriginResponseHeadersPolicy?:
|
|
68
|
-
siteCachePolicy:
|
|
84
|
+
siteCloudfrontFunction: IFunction
|
|
85
|
+
siteFunctionAssociations: FunctionAssociation[]
|
|
86
|
+
siteOriginRequestPolicy: OriginRequestPolicy
|
|
87
|
+
siteOriginResponseHeadersPolicy?: ResponseHeadersPolicy
|
|
88
|
+
siteCachePolicy: CachePolicy
|
|
69
89
|
|
|
70
90
|
constructor(parent: Construct, id: string, props: SiteWithEcsBackendProps) {
|
|
71
91
|
super(parent, id, props)
|
|
@@ -203,7 +223,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
203
223
|
* @summary Method to create iam policy for ECS Task
|
|
204
224
|
*/
|
|
205
225
|
protected createEcsPolicy() {
|
|
206
|
-
this.siteEcsPolicy = new
|
|
226
|
+
this.siteEcsPolicy = new PolicyDocument({
|
|
207
227
|
statements: [this.iamManager.statementForCreateAnyLogStream()],
|
|
208
228
|
})
|
|
209
229
|
}
|
|
@@ -256,16 +276,16 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
256
276
|
* Method to create container image for ECS task
|
|
257
277
|
*/
|
|
258
278
|
protected createEcsContainerImage() {
|
|
259
|
-
this.siteEcsContainerImage =
|
|
279
|
+
this.siteEcsContainerImage = ContainerImage.fromAsset(this.props.siteEcsContainerImagePath, {
|
|
260
280
|
buildArgs: this.siteEcsBuildArgs,
|
|
261
281
|
})
|
|
262
282
|
}
|
|
263
283
|
|
|
264
284
|
/**
|
|
265
|
-
* Method to create Application
|
|
285
|
+
* Method to create Application Load balanced ECS Fargate Service
|
|
266
286
|
*/
|
|
267
287
|
protected createEcsService() {
|
|
268
|
-
const fargateService = new
|
|
288
|
+
const fargateService = new ApplicationLoadBalancedFargateService(this, `${this.id}-ecs-service`, {
|
|
269
289
|
assignPublicIp: true,
|
|
270
290
|
certificate: this.siteRegionalCertificate,
|
|
271
291
|
cluster: this.siteEcsCluster,
|
|
@@ -274,7 +294,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
274
294
|
domainName: this.siteInternalDomainName,
|
|
275
295
|
domainZone: this.siteHostedZone,
|
|
276
296
|
enableECSManagedTags: true,
|
|
277
|
-
healthCheckGracePeriod:
|
|
297
|
+
healthCheckGracePeriod: Duration.seconds(60),
|
|
278
298
|
listenerPort: this.props.siteTask.listenerPort,
|
|
279
299
|
loadBalancerName: this.props.siteTask.loadBalancerName
|
|
280
300
|
? `${this.props.siteTask.loadBalancerName}-${this.props.stage}`
|
|
@@ -290,7 +310,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
290
310
|
environment: this.siteEcsEnvironment,
|
|
291
311
|
executionRole: this.siteEcsRole,
|
|
292
312
|
image: this.siteEcsContainerImage,
|
|
293
|
-
logDriver:
|
|
313
|
+
logDriver: LogDriver.awsLogs({
|
|
294
314
|
logGroup: this.siteEcsLogGroup,
|
|
295
315
|
logRetention: this.props.siteTask.logging?.logRetention,
|
|
296
316
|
multilinePattern: this.props.siteTask.logging?.multilinePattern,
|
|
@@ -307,11 +327,11 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
307
327
|
healthyGrpcCodes: this.props.siteHealthCheck.healthyGrpcCodes,
|
|
308
328
|
healthyHttpCodes: this.props.siteHealthCheck.healthyHttpCodes,
|
|
309
329
|
healthyThresholdCount: this.props.siteHealthCheck.healthyThresholdCount,
|
|
310
|
-
interval:
|
|
330
|
+
interval: Duration.seconds(this.props.siteHealthCheck.intervalInSecs),
|
|
311
331
|
path: this.props.siteHealthCheck.path ?? '/',
|
|
312
332
|
port: this.props.siteHealthCheck.port,
|
|
313
333
|
protocol: this.props.siteHealthCheck.protocol,
|
|
314
|
-
timeout:
|
|
334
|
+
timeout: Duration.seconds(this.props.siteHealthCheck.timeoutInSecs),
|
|
315
335
|
unhealthyThresholdCount: this.props.siteHealthCheck.unhealthyThresholdCount,
|
|
316
336
|
})
|
|
317
337
|
}
|
|
@@ -370,7 +390,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
370
390
|
|
|
371
391
|
/* add EFS permissions to ECS Role */
|
|
372
392
|
this.siteEcsRole.addToPolicy(
|
|
373
|
-
new
|
|
393
|
+
new PolicyStatement(this.iamManager.statementForWriteEfs([this.siteFileSystem.fileSystemArn]))
|
|
374
394
|
)
|
|
375
395
|
|
|
376
396
|
/* add the efs volume to ecs task definition */
|
|
@@ -411,17 +431,16 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
411
431
|
}
|
|
412
432
|
|
|
413
433
|
protected createSiteCachePolicy(id: string, siteCachePolicy: SiteCachePolicyProps) {
|
|
414
|
-
return new
|
|
434
|
+
return new CachePolicy(this, `${id}`, {
|
|
415
435
|
cachePolicyName: `${this.id}-${siteCachePolicy.cachePolicyName}`,
|
|
416
436
|
comment: `Policy for ${this.id}-distribution - ${this.props.stage} stage`,
|
|
417
|
-
|
|
418
|
-
minTtl: cdk.Duration.seconds(siteCachePolicy.minTtlInSeconds),
|
|
419
|
-
maxTtl: cdk.Duration.seconds(siteCachePolicy.maxTtlInSeconds),
|
|
420
|
-
enableAcceptEncodingGzip: siteCachePolicy.enableAcceptEncodingGzip,
|
|
437
|
+
cookieBehavior: siteCachePolicy.cookieBehavior,
|
|
421
438
|
enableAcceptEncodingBrotli: siteCachePolicy.enableAcceptEncodingBrotli,
|
|
422
|
-
|
|
439
|
+
enableAcceptEncodingGzip: siteCachePolicy.enableAcceptEncodingGzip,
|
|
423
440
|
headerBehavior: siteCachePolicy.headerBehavior,
|
|
424
|
-
|
|
441
|
+
maxTtl: Duration.seconds(siteCachePolicy.maxTtlInSeconds),
|
|
442
|
+
minTtl: Duration.seconds(siteCachePolicy.minTtlInSeconds),
|
|
443
|
+
queryStringBehavior: siteCachePolicy.queryStringBehavior,
|
|
425
444
|
})
|
|
426
445
|
}
|
|
427
446
|
|
|
@@ -435,7 +454,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
435
454
|
|
|
436
455
|
protected createSiteOriginRequestPolicy() {
|
|
437
456
|
if (!this.props.siteOriginRequestPolicy) return
|
|
438
|
-
this.siteOriginRequestPolicy = new
|
|
457
|
+
this.siteOriginRequestPolicy = new OriginRequestPolicy(this, `${this.id}-sorp`, {
|
|
439
458
|
comment: `Request Policy for ${this.id}-distribution - ${this.props.stage} stage`,
|
|
440
459
|
cookieBehavior: this.props.siteOriginRequestPolicy.cookieBehavior,
|
|
441
460
|
headerBehavior: this.props.siteOriginRequestPolicy.headerBehavior,
|
|
@@ -450,7 +469,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
450
469
|
|
|
451
470
|
protected createResponseHeaderPolicy(props: SiteResponseHeadersPolicyProps) {
|
|
452
471
|
if (!props) return undefined
|
|
453
|
-
return new
|
|
472
|
+
return new ResponseHeadersPolicy(this, `${this.id}-${props.type}-srhp`, {
|
|
454
473
|
...props,
|
|
455
474
|
comment: `Response Header Policy for ${props.type} for ${this.id}-distribution - ${this.props.stage} stage`,
|
|
456
475
|
responseHeadersPolicyName: `${this.id}-${props.type}-response`,
|
|
@@ -458,7 +477,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
458
477
|
...props.securityHeadersBehavior,
|
|
459
478
|
strictTransportSecurity: {
|
|
460
479
|
...props.securityHeadersBehavior?.strictTransportSecurity,
|
|
461
|
-
accessControlMaxAge:
|
|
480
|
+
accessControlMaxAge: Duration.seconds(
|
|
462
481
|
props.securityHeadersBehavior?.strictTransportSecurity?.accessControlMaxAgeInSeconds
|
|
463
482
|
),
|
|
464
483
|
},
|
|
@@ -475,10 +494,10 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
475
494
|
}
|
|
476
495
|
|
|
477
496
|
protected createSiteOrigin() {
|
|
478
|
-
this.siteOrigin = new
|
|
497
|
+
this.siteOrigin = new HttpOrigin(this.siteInternalDomainName, {
|
|
479
498
|
httpPort: this.props.siteTask.listenerPort,
|
|
480
499
|
originId: `${this.id}-server`,
|
|
481
|
-
protocolPolicy:
|
|
500
|
+
protocolPolicy: OriginProtocolPolicy.HTTPS_ONLY,
|
|
482
501
|
})
|
|
483
502
|
}
|
|
484
503
|
|
|
@@ -502,7 +521,7 @@ export class SiteWithEcsBackend extends CommonConstruct {
|
|
|
502
521
|
if (this.props.siteCloudfrontFunctionProps) {
|
|
503
522
|
this.siteFunctionAssociations = [
|
|
504
523
|
{
|
|
505
|
-
eventType:
|
|
524
|
+
eventType: FunctionEventType.VIEWER_REQUEST,
|
|
506
525
|
function: this.siteCloudfrontFunction,
|
|
507
526
|
},
|
|
508
527
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IBucket } from 'aws-cdk-lib/aws-s3'
|
|
2
|
+
import { BucketDeployment } from 'aws-cdk-lib/aws-s3-deployment'
|
|
2
3
|
import { Construct } from 'constructs'
|
|
3
|
-
import
|
|
4
|
-
import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment'
|
|
4
|
+
import { CommonConstruct } from '../../common'
|
|
5
5
|
import { StaticAssetDeploymentProps } from './types'
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -25,7 +25,7 @@ export class StaticAssetDeployment extends CommonConstruct {
|
|
|
25
25
|
id: string
|
|
26
26
|
|
|
27
27
|
/* construct resources */
|
|
28
|
-
staticAssetBucket:
|
|
28
|
+
staticAssetBucket: IBucket
|
|
29
29
|
|
|
30
30
|
constructor(parent: Construct, id: string, props: StaticAssetDeploymentProps) {
|
|
31
31
|
super(parent, id, props)
|
|
@@ -49,10 +49,10 @@ export class StaticAssetDeployment extends CommonConstruct {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
* @summary Deploy the static
|
|
52
|
+
* @summary Deploy the static assets into the static asset bucket
|
|
53
53
|
*/
|
|
54
54
|
protected deployStaticAssets() {
|
|
55
|
-
new
|
|
55
|
+
new BucketDeployment(this, `${this.id}-static-deployment`, {
|
|
56
56
|
...this.props.staticAssetDeployment,
|
|
57
57
|
destinationBucket: this.staticAssetBucket,
|
|
58
58
|
sources: this.props.staticAssetSources,
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ICertificate } from 'aws-cdk-lib/aws-certificatemanager'
|
|
2
|
+
import {
|
|
3
|
+
FunctionAssociation,
|
|
4
|
+
FunctionEventType,
|
|
5
|
+
IDistribution,
|
|
6
|
+
IFunction,
|
|
7
|
+
OriginAccessIdentity,
|
|
8
|
+
} from 'aws-cdk-lib/aws-cloudfront'
|
|
9
|
+
import { S3Origin } from 'aws-cdk-lib/aws-cloudfront-origins'
|
|
10
|
+
import { ARecord, IHostedZone } from 'aws-cdk-lib/aws-route53'
|
|
11
|
+
import { IBucket } from 'aws-cdk-lib/aws-s3'
|
|
6
12
|
import { Construct } from 'constructs'
|
|
7
13
|
import { CommonConstruct } from '../../common'
|
|
8
14
|
import { StaticSiteProps } from './types'
|
|
@@ -28,16 +34,16 @@ export class StaticSite extends CommonConstruct {
|
|
|
28
34
|
id: string
|
|
29
35
|
|
|
30
36
|
/* static site resources */
|
|
31
|
-
siteHostedZone:
|
|
32
|
-
siteCertificate:
|
|
33
|
-
siteARecord:
|
|
34
|
-
siteBucket:
|
|
35
|
-
siteOrigin:
|
|
36
|
-
siteDistribution:
|
|
37
|
-
siteLogBucket:
|
|
38
|
-
siteOriginAccessIdentity:
|
|
39
|
-
siteCloudfrontFunction:
|
|
40
|
-
siteFunctionAssociations:
|
|
37
|
+
siteHostedZone: IHostedZone
|
|
38
|
+
siteCertificate: ICertificate
|
|
39
|
+
siteARecord: ARecord
|
|
40
|
+
siteBucket: IBucket
|
|
41
|
+
siteOrigin: S3Origin
|
|
42
|
+
siteDistribution: IDistribution
|
|
43
|
+
siteLogBucket: IBucket
|
|
44
|
+
siteOriginAccessIdentity: OriginAccessIdentity
|
|
45
|
+
siteCloudfrontFunction: IFunction
|
|
46
|
+
siteFunctionAssociations: FunctionAssociation[]
|
|
41
47
|
|
|
42
48
|
constructor(parent: Construct, id: string, props: StaticSiteProps) {
|
|
43
49
|
super(parent, id, props)
|
|
@@ -113,7 +119,7 @@ export class StaticSite extends CommonConstruct {
|
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
protected createSiteOrigin() {
|
|
116
|
-
this.siteOrigin = new
|
|
122
|
+
this.siteOrigin = new S3Origin(this.siteBucket)
|
|
117
123
|
}
|
|
118
124
|
|
|
119
125
|
/**
|
|
@@ -136,7 +142,7 @@ export class StaticSite extends CommonConstruct {
|
|
|
136
142
|
if (this.props.siteCloudfrontFunctionProps) {
|
|
137
143
|
this.siteFunctionAssociations = [
|
|
138
144
|
{
|
|
139
|
-
eventType:
|
|
145
|
+
eventType: FunctionEventType.VIEWER_REQUEST,
|
|
140
146
|
function: this.siteCloudfrontFunction,
|
|
141
147
|
},
|
|
142
148
|
]
|
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { Tags } from 'aws-cdk-lib'
|
|
2
|
+
import {
|
|
3
|
+
Cors,
|
|
4
|
+
Deployment,
|
|
5
|
+
DomainName,
|
|
6
|
+
EndpointType,
|
|
7
|
+
IAuthorizer,
|
|
8
|
+
IResource,
|
|
9
|
+
IRestApi,
|
|
10
|
+
Integration,
|
|
11
|
+
LambdaRestApi,
|
|
12
|
+
SecurityPolicy,
|
|
13
|
+
} from 'aws-cdk-lib/aws-apigateway'
|
|
14
|
+
import { ICertificate } from 'aws-cdk-lib/aws-certificatemanager'
|
|
15
|
+
import { IFunction } from 'aws-cdk-lib/aws-lambda'
|
|
16
|
+
import { CommonConstruct } from '../../common'
|
|
17
|
+
import { createCfnOutput } from '../../utils'
|
|
6
18
|
import { LambdaRestApiProps } from './types'
|
|
7
|
-
import { CommonConstruct } from '../../../common'
|
|
8
19
|
|
|
9
20
|
/**
|
|
10
21
|
* @classdesc Provides operations on AWS API Gateway.
|
|
@@ -14,7 +25,7 @@ import { CommonConstruct } from '../../../common'
|
|
|
14
25
|
* import { CommonConstruct } from '@gradientedge/cdk-utils'
|
|
15
26
|
*
|
|
16
27
|
* class CustomConstruct extends CommonConstruct {
|
|
17
|
-
* constructor(parent:
|
|
28
|
+
* constructor(parent: Construct, id: string, props: common.CommonStackProps) {
|
|
18
29
|
* super(parent, id, props)
|
|
19
30
|
* this.props = props
|
|
20
31
|
* const lambdaFunction = this.lambdaManager.createLambdaFunction('MyFunction', this, role, layers, code)
|
|
@@ -31,14 +42,9 @@ export class ApiManager {
|
|
|
31
42
|
* @param props lambda rest restApi props
|
|
32
43
|
* @param lambdaFunction
|
|
33
44
|
*/
|
|
34
|
-
public createLambdaRestApi(
|
|
35
|
-
id: string,
|
|
36
|
-
scope: CommonConstruct,
|
|
37
|
-
props: LambdaRestApiProps,
|
|
38
|
-
lambdaFunction: lambda.IFunction
|
|
39
|
-
) {
|
|
45
|
+
public createLambdaRestApi(id: string, scope: CommonConstruct, props: LambdaRestApiProps, lambdaFunction: IFunction) {
|
|
40
46
|
if (!props) throw `Api props undefined for ${id}`
|
|
41
|
-
const api = new
|
|
47
|
+
const api = new LambdaRestApi(scope, `${id}`, {
|
|
42
48
|
binaryMediaTypes: props.binaryMediaTypes,
|
|
43
49
|
cloudWatchRole: props.cloudWatchRole || false,
|
|
44
50
|
defaultCorsPreflightOptions: props.defaultCorsPreflightOptions,
|
|
@@ -63,7 +69,7 @@ export class ApiManager {
|
|
|
63
69
|
},
|
|
64
70
|
domainName: props.domainName,
|
|
65
71
|
endpointConfiguration: {
|
|
66
|
-
types: props.endpointConfiguration?.types || [
|
|
72
|
+
types: props.endpointConfiguration?.types || [EndpointType.REGIONAL],
|
|
67
73
|
vpcEndpoints: props.endpointConfiguration?.vpcEndpoints,
|
|
68
74
|
},
|
|
69
75
|
endpointTypes: props.endpointTypes,
|
|
@@ -79,12 +85,12 @@ export class ApiManager {
|
|
|
79
85
|
|
|
80
86
|
if (props.tags && props.tags.length > 0) {
|
|
81
87
|
props.tags.forEach(tag => {
|
|
82
|
-
|
|
88
|
+
Tags.of(api).add(tag.key, tag.value)
|
|
83
89
|
})
|
|
84
90
|
}
|
|
85
91
|
|
|
86
|
-
|
|
87
|
-
|
|
92
|
+
createCfnOutput(`${id}-restApiId`, scope, api.restApiId)
|
|
93
|
+
createCfnOutput(`${id}-restApiName`, scope, api.restApiName)
|
|
88
94
|
|
|
89
95
|
return api
|
|
90
96
|
}
|
|
@@ -96,15 +102,15 @@ export class ApiManager {
|
|
|
96
102
|
* @param domainName the domain name to use
|
|
97
103
|
* @param certificate the certificate used for custom restApi domain
|
|
98
104
|
*/
|
|
99
|
-
public createApiDomain(id: string, scope: CommonConstruct, domainName: string, certificate:
|
|
100
|
-
const apiDomain = new
|
|
105
|
+
public createApiDomain(id: string, scope: CommonConstruct, domainName: string, certificate: ICertificate) {
|
|
106
|
+
const apiDomain = new DomainName(scope, `${id}`, {
|
|
101
107
|
certificate: certificate,
|
|
102
108
|
domainName: domainName,
|
|
103
|
-
endpointType: scope.isProductionStage() ?
|
|
104
|
-
securityPolicy:
|
|
109
|
+
endpointType: scope.isProductionStage() ? EndpointType.EDGE : EndpointType.REGIONAL,
|
|
110
|
+
securityPolicy: SecurityPolicy.TLS_1_2,
|
|
105
111
|
})
|
|
106
112
|
|
|
107
|
-
|
|
113
|
+
createCfnOutput(`${id}-customDomainName`, scope, apiDomain.domainName)
|
|
108
114
|
|
|
109
115
|
return apiDomain
|
|
110
116
|
}
|
|
@@ -127,24 +133,24 @@ export class ApiManager {
|
|
|
127
133
|
public createApiResource(
|
|
128
134
|
id: string,
|
|
129
135
|
scope: CommonConstruct,
|
|
130
|
-
parent:
|
|
136
|
+
parent: IResource,
|
|
131
137
|
path: string,
|
|
132
|
-
integration:
|
|
138
|
+
integration: Integration,
|
|
133
139
|
addProxy: boolean,
|
|
134
|
-
authorizer?:
|
|
140
|
+
authorizer?: IAuthorizer,
|
|
135
141
|
allowedOrigins?: string[],
|
|
136
142
|
allowedMethods?: string[],
|
|
137
143
|
allowedHeaders?: string[],
|
|
138
144
|
methodRequestParameters?: { [param: string]: boolean },
|
|
139
|
-
proxyIntegration?:
|
|
145
|
+
proxyIntegration?: Integration
|
|
140
146
|
) {
|
|
141
|
-
const methods = allowedMethods ??
|
|
147
|
+
const methods = allowedMethods ?? Cors.ALL_METHODS
|
|
142
148
|
const resource = parent.addResource(path, {
|
|
143
149
|
defaultCorsPreflightOptions: {
|
|
144
150
|
allowCredentials: true,
|
|
145
|
-
allowHeaders: allowedHeaders ??
|
|
151
|
+
allowHeaders: allowedHeaders ?? Cors.DEFAULT_HEADERS,
|
|
146
152
|
allowMethods: [...methods, 'OPTIONS'],
|
|
147
|
-
allowOrigins: allowedOrigins ??
|
|
153
|
+
allowOrigins: allowedOrigins ?? Cors.ALL_ORIGINS,
|
|
148
154
|
},
|
|
149
155
|
})
|
|
150
156
|
methods.forEach(method =>
|
|
@@ -153,15 +159,15 @@ export class ApiManager {
|
|
|
153
159
|
requestParameters: methodRequestParameters,
|
|
154
160
|
})
|
|
155
161
|
)
|
|
156
|
-
|
|
162
|
+
createCfnOutput(`${id}-${path}ResourceId`, scope, resource.resourceId)
|
|
157
163
|
|
|
158
164
|
if (addProxy) {
|
|
159
165
|
const resourceProxy = resource.addResource(`{${path}+}`, {
|
|
160
166
|
defaultCorsPreflightOptions: {
|
|
161
167
|
allowCredentials: true,
|
|
162
|
-
allowHeaders: allowedHeaders ??
|
|
168
|
+
allowHeaders: allowedHeaders ?? Cors.DEFAULT_HEADERS,
|
|
163
169
|
allowMethods: [...methods, 'OPTIONS'],
|
|
164
|
-
allowOrigins: allowedOrigins ??
|
|
170
|
+
allowOrigins: allowedOrigins ?? Cors.ALL_ORIGINS,
|
|
165
171
|
},
|
|
166
172
|
})
|
|
167
173
|
methods.forEach(method =>
|
|
@@ -170,7 +176,7 @@ export class ApiManager {
|
|
|
170
176
|
requestParameters: methodRequestParameters,
|
|
171
177
|
})
|
|
172
178
|
)
|
|
173
|
-
|
|
179
|
+
createCfnOutput(`${id}-${path}ProxyResourceId`, scope, resourceProxy.resourceId)
|
|
174
180
|
}
|
|
175
181
|
|
|
176
182
|
return resource
|
|
@@ -182,8 +188,8 @@ export class ApiManager {
|
|
|
182
188
|
* @param scope
|
|
183
189
|
* @param restApi
|
|
184
190
|
*/
|
|
185
|
-
public createApiDeployment(id: string, scope: CommonConstruct, restApi:
|
|
186
|
-
new
|
|
191
|
+
public createApiDeployment(id: string, scope: CommonConstruct, restApi: IRestApi) {
|
|
192
|
+
new Deployment(scope, `${id}`, {
|
|
187
193
|
api: restApi,
|
|
188
194
|
retainDeployments: false,
|
|
189
195
|
})
|