@gradientedge/cdk-utils 4.4.8 → 4.4.9
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/node_modules/uuid/dist/bin/uuid +2 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-browser/index.js +9 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-browser/md5.js +215 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-browser/nil.js +1 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-browser/parse.js +35 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-browser/regex.js +1 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-browser/rng.js +19 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-browser/sha1.js +96 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-browser/stringify.js +30 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-browser/v1.js +95 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-browser/v3.js +4 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-browser/v35.js +64 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-browser/v4.js +24 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-browser/v5.js +4 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-browser/validate.js +7 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-browser/version.js +11 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-node/index.js +9 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-node/md5.js +13 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-node/nil.js +1 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-node/parse.js +35 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-node/regex.js +1 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-node/rng.js +12 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-node/sha1.js +13 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-node/stringify.js +29 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-node/v1.js +95 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-node/v3.js +4 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-node/v35.js +64 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-node/v4.js +24 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-node/v5.js +4 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-node/validate.js +7 -0
- package/app/api-destined-function/node_modules/uuid/dist/esm-node/version.js +11 -0
- package/app/api-destined-function/node_modules/uuid/dist/index.js +79 -0
- package/app/api-destined-function/node_modules/uuid/dist/md5-browser.js +223 -0
- package/app/api-destined-function/node_modules/uuid/dist/md5.js +23 -0
- package/app/api-destined-function/node_modules/uuid/dist/nil.js +8 -0
- package/app/api-destined-function/node_modules/uuid/dist/parse.js +45 -0
- package/app/api-destined-function/node_modules/uuid/dist/regex.js +8 -0
- package/app/api-destined-function/node_modules/uuid/dist/rng-browser.js +26 -0
- package/app/api-destined-function/node_modules/uuid/dist/rng.js +24 -0
- package/app/api-destined-function/node_modules/uuid/dist/sha1-browser.js +104 -0
- package/app/api-destined-function/node_modules/uuid/dist/sha1.js +23 -0
- package/app/api-destined-function/node_modules/uuid/dist/stringify.js +39 -0
- package/app/api-destined-function/node_modules/uuid/dist/umd/uuid.min.js +1 -0
- package/app/api-destined-function/node_modules/uuid/dist/umd/uuidNIL.min.js +1 -0
- package/app/api-destined-function/node_modules/uuid/dist/umd/uuidParse.min.js +1 -0
- package/app/api-destined-function/node_modules/uuid/dist/umd/uuidStringify.min.js +1 -0
- package/app/api-destined-function/node_modules/uuid/dist/umd/uuidValidate.min.js +1 -0
- package/app/api-destined-function/node_modules/uuid/dist/umd/uuidVersion.min.js +1 -0
- package/app/api-destined-function/node_modules/uuid/dist/umd/uuidv1.min.js +1 -0
- package/app/api-destined-function/node_modules/uuid/dist/umd/uuidv3.min.js +1 -0
- package/app/api-destined-function/node_modules/uuid/dist/umd/uuidv4.min.js +1 -0
- package/app/api-destined-function/node_modules/uuid/dist/umd/uuidv5.min.js +1 -0
- package/app/api-destined-function/node_modules/uuid/dist/uuid-bin.js +85 -0
- package/app/api-destined-function/node_modules/uuid/dist/v1.js +107 -0
- package/app/api-destined-function/node_modules/uuid/dist/v3.js +16 -0
- package/app/api-destined-function/node_modules/uuid/dist/v35.js +78 -0
- package/app/api-destined-function/node_modules/uuid/dist/v4.js +37 -0
- package/app/api-destined-function/node_modules/uuid/dist/v5.js +16 -0
- package/app/api-destined-function/node_modules/uuid/dist/validate.js +17 -0
- package/app/api-destined-function/node_modules/uuid/dist/version.js +21 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/.bin/uuid +2 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/.yarn-integrity +109 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/@types/uuid/LICENSE +21 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/@types/uuid/README.md +16 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/@types/uuid/index.d.mts +10 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/@types/uuid/index.d.ts +80 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/@types/uuid/package.json +54 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/LICENSE.md +9 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/README.md +505 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/bin/uuid +2 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-browser/index.js +9 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-browser/md5.js +215 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-browser/nil.js +1 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-browser/parse.js +35 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-browser/regex.js +1 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-browser/rng.js +19 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-browser/sha1.js +96 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-browser/stringify.js +30 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-browser/v1.js +95 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-browser/v3.js +4 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-browser/v35.js +64 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-browser/v4.js +24 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-browser/v5.js +4 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-browser/validate.js +7 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-browser/version.js +11 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-node/index.js +9 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-node/md5.js +13 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-node/nil.js +1 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-node/parse.js +35 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-node/regex.js +1 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-node/rng.js +12 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-node/sha1.js +13 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-node/stringify.js +29 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-node/v1.js +95 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-node/v3.js +4 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-node/v35.js +64 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-node/v4.js +24 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-node/v5.js +4 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-node/validate.js +7 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/esm-node/version.js +11 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/index.js +79 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/md5-browser.js +223 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/md5.js +23 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/nil.js +8 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/parse.js +45 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/regex.js +8 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/rng-browser.js +26 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/rng.js +24 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/sha1-browser.js +104 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/sha1.js +23 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/stringify.js +39 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/umd/uuid.min.js +1 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/umd/uuidNIL.min.js +1 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/umd/uuidParse.min.js +1 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/umd/uuidStringify.min.js +1 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/umd/uuidValidate.min.js +1 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/umd/uuidVersion.min.js +1 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/umd/uuidv1.min.js +1 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/umd/uuidv3.min.js +1 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/umd/uuidv4.min.js +1 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/umd/uuidv5.min.js +1 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/uuid-bin.js +85 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/v1.js +107 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/v3.js +16 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/v35.js +78 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/v4.js +37 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/v5.js +16 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/validate.js +17 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/dist/version.js +21 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/package.json +135 -0
- package/dist/app/api-destined-function/layers/nodejs/node_modules/uuid/wrapper.mjs +10 -0
- package/dist/app/api-destined-function/layers/nodejs/package.json +30 -0
- package/dist/app/api-destined-function/src/lib/lambda.d.ts +19 -0
- package/dist/app/api-destined-function/src/lib/lambda.d.ts.map +1 -0
- package/dist/app/api-destined-function/src/lib/lambda.js +34 -0
- package/dist/app/api-destined-function/src/lib/lambda.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js.map +1 -0
- package/dist/src/lib/common/construct.d.ts +80 -0
- package/dist/src/lib/common/construct.d.ts.map +1 -0
- package/dist/src/lib/common/construct.js +134 -0
- package/dist/src/lib/common/construct.js.map +1 -0
- package/dist/src/lib/common/index.d.ts +3 -0
- package/dist/src/lib/common/index.d.ts.map +1 -0
- package/dist/src/lib/common/index.js +15 -0
- package/dist/src/lib/common/index.js.map +1 -0
- package/dist/src/lib/common/stack.d.ts +55 -0
- package/dist/src/lib/common/stack.d.ts.map +1 -0
- package/dist/src/lib/common/stack.js +148 -0
- package/dist/src/lib/common/stack.js.map +1 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/api-destination-event.d.ts +17 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/api-destination-event.d.ts.map +1 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/api-destination-event.js +18 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/api-destination-event.js.map +1 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/api-destined-lambda.d.ts +20 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/api-destined-lambda.d.ts.map +1 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/api-destined-lambda.js +20 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/api-destined-lambda.js.map +1 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/api-destined-rest-api.d.ts +36 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/api-destined-rest-api.d.ts.map +1 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/api-destined-rest-api.js +30 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/api-destined-rest-api.js.map +1 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/index.d.ts +5 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/index.d.ts.map +1 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/index.js +17 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/index.js.map +1 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/main.d.ts +135 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/main.d.ts.map +1 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/main.js +488 -0
- package/dist/src/lib/construct/api-to-eventbridge-target/main.js.map +1 -0
- package/dist/src/lib/construct/graphql-api-lambda/index.d.ts +2 -0
- package/dist/src/lib/construct/graphql-api-lambda/index.d.ts.map +1 -0
- package/dist/src/lib/construct/graphql-api-lambda/index.js +14 -0
- package/dist/src/lib/construct/graphql-api-lambda/index.js.map +1 -0
- package/dist/src/lib/construct/graphql-api-lambda/main.d.ts +113 -0
- package/dist/src/lib/construct/graphql-api-lambda/main.d.ts.map +1 -0
- package/dist/src/lib/construct/graphql-api-lambda/main.js +202 -0
- package/dist/src/lib/construct/graphql-api-lambda/main.js.map +1 -0
- package/dist/src/lib/construct/index.d.ts +5 -0
- package/dist/src/lib/construct/index.d.ts.map +1 -0
- package/dist/src/lib/construct/index.js +17 -0
- package/dist/src/lib/construct/index.js.map +1 -0
- package/dist/src/lib/construct/site-with-ecs-backend/index.d.ts +2 -0
- package/dist/src/lib/construct/site-with-ecs-backend/index.d.ts.map +1 -0
- package/dist/src/lib/construct/site-with-ecs-backend/index.js +14 -0
- package/dist/src/lib/construct/site-with-ecs-backend/index.js.map +1 -0
- package/dist/src/lib/construct/site-with-ecs-backend/main.d.ts +168 -0
- package/dist/src/lib/construct/site-with-ecs-backend/main.d.ts.map +1 -0
- package/dist/src/lib/construct/site-with-ecs-backend/main.js +328 -0
- package/dist/src/lib/construct/site-with-ecs-backend/main.js.map +1 -0
- package/dist/src/lib/construct/static-site/index.d.ts +2 -0
- package/dist/src/lib/construct/static-site/index.d.ts.map +1 -0
- package/dist/src/lib/construct/static-site/index.js +14 -0
- package/dist/src/lib/construct/static-site/index.js.map +1 -0
- package/dist/src/lib/construct/static-site/main.d.ts +95 -0
- package/dist/src/lib/construct/static-site/main.d.ts.map +1 -0
- package/dist/src/lib/construct/static-site/main.js +169 -0
- package/dist/src/lib/construct/static-site/main.js.map +1 -0
- package/dist/src/lib/manager/aws/acm-manager.d.ts +47 -0
- package/dist/src/lib/manager/aws/acm-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/acm-manager.js +91 -0
- package/dist/src/lib/manager/aws/acm-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/api-manager.d.ts +44 -0
- package/dist/src/lib/manager/aws/api-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/api-manager.js +112 -0
- package/dist/src/lib/manager/aws/api-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/app-config-manager.d.ts +66 -0
- package/dist/src/lib/manager/aws/app-config-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/app-config-manager.js +149 -0
- package/dist/src/lib/manager/aws/app-config-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/cloudfront-manager.d.ts +113 -0
- package/dist/src/lib/manager/aws/cloudfront-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/cloudfront-manager.js +283 -0
- package/dist/src/lib/manager/aws/cloudfront-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/cloudtrail-manager.d.ts +49 -0
- package/dist/src/lib/manager/aws/cloudtrail-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/cloudtrail-manager.js +100 -0
- package/dist/src/lib/manager/aws/cloudtrail-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/cloudwatch-manager.d.ts +122 -0
- package/dist/src/lib/manager/aws/cloudwatch-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/cloudwatch-manager.js +353 -0
- package/dist/src/lib/manager/aws/cloudwatch-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/codebuild-manager.d.ts +41 -0
- package/dist/src/lib/manager/aws/codebuild-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/codebuild-manager.js +95 -0
- package/dist/src/lib/manager/aws/codebuild-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/dynamodb-manager.d.ts +33 -0
- package/dist/src/lib/manager/aws/dynamodb-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/dynamodb-manager.js +80 -0
- package/dist/src/lib/manager/aws/dynamodb-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/ecr-manager.d.ts +32 -0
- package/dist/src/lib/manager/aws/ecr-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/ecr-manager.js +61 -0
- package/dist/src/lib/manager/aws/ecr-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/ecs-manager.d.ts +49 -0
- package/dist/src/lib/manager/aws/ecs-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/ecs-manager.js +104 -0
- package/dist/src/lib/manager/aws/ecs-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/eks-manager.d.ts +37 -0
- package/dist/src/lib/manager/aws/eks-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/eks-manager.js +110 -0
- package/dist/src/lib/manager/aws/eks-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/event-manager.d.ts +68 -0
- package/dist/src/lib/manager/aws/event-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/event-manager.js +163 -0
- package/dist/src/lib/manager/aws/event-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/iam-manager.d.ts +155 -0
- package/dist/src/lib/manager/aws/iam-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/iam-manager.js +381 -0
- package/dist/src/lib/manager/aws/iam-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/index.d.ts +23 -0
- package/dist/src/lib/manager/aws/index.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/index.js +35 -0
- package/dist/src/lib/manager/aws/index.js.map +1 -0
- package/dist/src/lib/manager/aws/lambda-manager.d.ts +95 -0
- package/dist/src/lib/manager/aws/lambda-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/lambda-manager.js +197 -0
- package/dist/src/lib/manager/aws/lambda-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/log-manager.d.ts +52 -0
- package/dist/src/lib/manager/aws/log-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/log-manager.js +109 -0
- package/dist/src/lib/manager/aws/log-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/route53-manager.d.ts +69 -0
- package/dist/src/lib/manager/aws/route53-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/route53-manager.js +159 -0
- package/dist/src/lib/manager/aws/route53-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/s3-manager.d.ts +74 -0
- package/dist/src/lib/manager/aws/s3-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/s3-manager.js +203 -0
- package/dist/src/lib/manager/aws/s3-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/secrets-manager.d.ts +58 -0
- package/dist/src/lib/manager/aws/secrets-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/secrets-manager.js +117 -0
- package/dist/src/lib/manager/aws/secrets-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/sns-manager.d.ts +43 -0
- package/dist/src/lib/manager/aws/sns-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/sns-manager.js +91 -0
- package/dist/src/lib/manager/aws/sns-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/ssm-manager.d.ts +61 -0
- package/dist/src/lib/manager/aws/ssm-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/ssm-manager.js +125 -0
- package/dist/src/lib/manager/aws/ssm-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/vpc-manager.d.ts +46 -0
- package/dist/src/lib/manager/aws/vpc-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/vpc-manager.js +95 -0
- package/dist/src/lib/manager/aws/vpc-manager.js.map +1 -0
- package/dist/src/lib/manager/aws/waf-manager.d.ts +40 -0
- package/dist/src/lib/manager/aws/waf-manager.d.ts.map +1 -0
- package/dist/src/lib/manager/aws/waf-manager.js +90 -0
- package/dist/src/lib/manager/aws/waf-manager.js.map +1 -0
- package/dist/src/lib/manager/index.d.ts +2 -0
- package/dist/src/lib/manager/index.d.ts.map +1 -0
- package/dist/src/lib/manager/index.js +14 -0
- package/dist/src/lib/manager/index.js.map +1 -0
- package/dist/src/lib/types/aws/index.d.ts +480 -0
- package/dist/src/lib/types/aws/index.d.ts.map +1 -0
- package/dist/src/lib/types/aws/index.js +3 -0
- package/dist/src/lib/types/aws/index.js.map +1 -0
- package/dist/src/lib/types/index.d.ts +2 -0
- package/dist/src/lib/types/index.d.ts.map +1 -0
- package/dist/src/lib/types/index.js +14 -0
- package/dist/src/lib/types/index.js.map +1 -0
- package/dist/src/lib/utils/aws/index.d.ts +16 -0
- package/dist/src/lib/utils/aws/index.d.ts.map +1 -0
- package/dist/src/lib/utils/aws/index.js +50 -0
- package/dist/src/lib/utils/aws/index.js.map +1 -0
- package/dist/src/lib/utils/index.d.ts +63 -0
- package/dist/src/lib/utils/index.d.ts.map +1 -0
- package/dist/src/lib/utils/index.js +85 -0
- package/dist/src/lib/utils/index.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.Route53Manager = void 0;
|
|
23
|
+
const route53 = __importStar(require("aws-cdk-lib/aws-route53"));
|
|
24
|
+
const route53Targets = __importStar(require("aws-cdk-lib/aws-route53-targets"));
|
|
25
|
+
const utils = __importStar(require("../../utils"));
|
|
26
|
+
/**
|
|
27
|
+
* @stability stable
|
|
28
|
+
* @category cdk-utils.route53-manager
|
|
29
|
+
* @subcategory Construct
|
|
30
|
+
* @classdesc Provides operations on AWS Route53.
|
|
31
|
+
* - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
|
|
32
|
+
* - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
|
|
33
|
+
* @example
|
|
34
|
+
* import * as common from '@gradientedge/cdk-utils'
|
|
35
|
+
*
|
|
36
|
+
* class CustomConstruct extends common.common.CommonConstruct {
|
|
37
|
+
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
38
|
+
* super(parent, id, props)
|
|
39
|
+
* this.props = props
|
|
40
|
+
* this.route53Manager.createHostedZone('MyHostedZone', this)
|
|
41
|
+
* }
|
|
42
|
+
* }
|
|
43
|
+
*
|
|
44
|
+
* @see [CDK Route53 Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_route53-readme.html}
|
|
45
|
+
*/
|
|
46
|
+
class Route53Manager {
|
|
47
|
+
/**
|
|
48
|
+
* @summary Method to create a hosted zone
|
|
49
|
+
* @param {string} id scoped id of the resource
|
|
50
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
51
|
+
* @param {types.Route53Props} props
|
|
52
|
+
*/
|
|
53
|
+
createHostedZone(id, scope, props) {
|
|
54
|
+
let hostedZone;
|
|
55
|
+
if (!props)
|
|
56
|
+
throw `Route53 props undefined`;
|
|
57
|
+
if (props.useExistingHostedZone) {
|
|
58
|
+
hostedZone = route53.HostedZone.fromLookup(scope, `${id}`, {
|
|
59
|
+
domainName: scope.props.domainName,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
hostedZone = new route53.HostedZone(scope, `${id}`, {
|
|
64
|
+
zoneName: scope.props.domainName,
|
|
65
|
+
comment: `Hosted zone for ${scope.props.domainName}`,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
utils.createCfnOutput(`${id}-hostedZoneId`, scope, hostedZone.hostedZoneId);
|
|
69
|
+
utils.createCfnOutput(`${id}-hostedZoneArn`, scope, hostedZone.hostedZoneArn);
|
|
70
|
+
return hostedZone;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @summary Method to create/lookup a hosted zone
|
|
74
|
+
* @param {string} id scoped id of the resource
|
|
75
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
76
|
+
* @param useExistingHostedZone Flag to indicate whether to lookup vs create new hosted zone
|
|
77
|
+
*/
|
|
78
|
+
withHostedZoneFromFullyQualifiedDomainName(id, scope, useExistingHostedZone) {
|
|
79
|
+
let hostedZone;
|
|
80
|
+
if (useExistingHostedZone) {
|
|
81
|
+
hostedZone = route53.HostedZone.fromLookup(scope, `${id}`, {
|
|
82
|
+
domainName: scope.fullyQualifiedDomainName,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
hostedZone = new route53.HostedZone(scope, `${id}`, {
|
|
87
|
+
zoneName: scope.fullyQualifiedDomainName,
|
|
88
|
+
comment: `Hosted zone for ${scope.fullyQualifiedDomainName}`,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
utils.createCfnOutput(`${id}-hostedZoneId`, scope, hostedZone.hostedZoneId);
|
|
92
|
+
utils.createCfnOutput(`${id}-hostedZoneArn`, scope, hostedZone.hostedZoneArn);
|
|
93
|
+
return hostedZone;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* @summary Method to create a-record for cloudfront target
|
|
97
|
+
* @param {string} id scoped id of the resource
|
|
98
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
99
|
+
* @param {cloudfront.IDistribution} distribution
|
|
100
|
+
* @param {route53.IHostedZone} hostedZone
|
|
101
|
+
* @param {string} recordName
|
|
102
|
+
*/
|
|
103
|
+
createCloudFrontTargetARecord(id, scope, distribution, hostedZone, recordName) {
|
|
104
|
+
if (!distribution)
|
|
105
|
+
throw `Distribution undefined`;
|
|
106
|
+
if (!hostedZone)
|
|
107
|
+
throw `HostedZone undefined`;
|
|
108
|
+
const aRecord = new route53.ARecord(scope, `${id}`, {
|
|
109
|
+
recordName: recordName && scope.isProductionStage() ? `${recordName}` : `${recordName}-${scope.props.stage}`,
|
|
110
|
+
target: route53.RecordTarget.fromAlias(new route53Targets.CloudFrontTarget(distribution)),
|
|
111
|
+
zone: hostedZone,
|
|
112
|
+
});
|
|
113
|
+
utils.createCfnOutput(`${id}-aRecordDomainName`, scope, aRecord.domainName);
|
|
114
|
+
return aRecord;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* @summary Method to create a-record for cloudfront target
|
|
118
|
+
* @param {string} id scoped id of the resource
|
|
119
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
120
|
+
* @param {cloudfront.IDistribution} distribution
|
|
121
|
+
* @param {route53.IHostedZone} hostedZone
|
|
122
|
+
* @param {string} recordName
|
|
123
|
+
*/
|
|
124
|
+
createCloudFrontTargetARecordV2(id, scope, distribution, hostedZone, recordName) {
|
|
125
|
+
if (!distribution)
|
|
126
|
+
throw `Distribution undefined`;
|
|
127
|
+
if (!hostedZone)
|
|
128
|
+
throw `HostedZone undefined`;
|
|
129
|
+
const aRecord = new route53.ARecord(scope, `${id}`, {
|
|
130
|
+
recordName: recordName,
|
|
131
|
+
target: route53.RecordTarget.fromAlias(new route53Targets.CloudFrontTarget(distribution)),
|
|
132
|
+
zone: hostedZone,
|
|
133
|
+
});
|
|
134
|
+
utils.createCfnOutput(`${id}-aRecordDomainName`, scope, aRecord.domainName);
|
|
135
|
+
return aRecord;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* @summary Method to create a-record for restApi gateway target
|
|
139
|
+
* @param {string} id scoped id of the resource
|
|
140
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
141
|
+
* @param recordName
|
|
142
|
+
* @param apiDomain
|
|
143
|
+
* @param hostedZone
|
|
144
|
+
*/
|
|
145
|
+
createApiGatewayARecord(id, scope, recordName, apiDomain, hostedZone) {
|
|
146
|
+
let apiRecordName = '';
|
|
147
|
+
if (recordName && recordName !== '')
|
|
148
|
+
apiRecordName = scope.isProductionStage() ? `${recordName}` : `${recordName}-${scope.props.stage}`;
|
|
149
|
+
const apiARecord = new route53.ARecord(scope, `${id}`, {
|
|
150
|
+
recordName: apiRecordName,
|
|
151
|
+
target: route53.RecordTarget.fromAlias(new route53Targets.ApiGatewayDomain(apiDomain)),
|
|
152
|
+
zone: hostedZone,
|
|
153
|
+
});
|
|
154
|
+
utils.createCfnOutput(`${id}-a-record-domain-name`, scope, apiARecord.domainName);
|
|
155
|
+
return apiARecord;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
exports.Route53Manager = Route53Manager;
|
|
159
|
+
//# sourceMappingURL=route53-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route53-manager.js","sourceRoot":"","sources":["../../../../../src/lib/manager/aws/route53-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,iEAAkD;AAClD,gFAAiE;AAGjE,mDAAoC;AAEpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,cAAc;IACzB;;;;;OAKG;IACI,gBAAgB,CAAC,EAAU,EAAE,KAA6B,EAAE,KAAyB;QAC1F,IAAI,UAA+B,CAAA;QAEnC,IAAI,CAAC,KAAK;YAAE,MAAM,yBAAyB,CAAA;QAE3C,IAAI,KAAK,CAAC,qBAAqB,EAAE;YAC/B,UAAU,GAAG,OAAO,CAAC,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C;YACzF,IAAI,EAAE,UAAU;SACjB,CAAC,CAAA;QAEF,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE,oBAAoB,EAAE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CAAA;QAE3E,OAAO,OAAO,CAAA;IAChB,CAAC;IAED;;;;;;;OAOG;IACI,uBAAuB,CAC5B,EAAU,EACV,KAA6B,EAC7B,UAAkB,EAClB,SAA0B,EAC1B,UAA+B;QAE/B,IAAI,aAAa,GAAG,EAAE,CAAA;QACtB,IAAI,UAAU,IAAI,UAAU,KAAK,EAAE;YACjC,aAAa,GAAG,KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;QAEpG,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE;YACrD,UAAU,EAAE,aAAa;YACzB,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,IAAI,cAAc,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC;YACtF,IAAI,EAAE,UAAU;SACjB,CAAC,CAAA;QAEF,KAAK,CAAC,eAAe,CAAC,GAAG,EAAE,uBAAuB,EAAE,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,CAAA;QAEjF,OAAO,UAAU,CAAA;IACnB,CAAC;CACF;AAlJD,wCAkJC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as cdk from 'aws-cdk-lib';
|
|
2
|
+
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
|
|
3
|
+
import * as s3 from 'aws-cdk-lib/aws-s3';
|
|
4
|
+
import * as s3deploy from 'aws-cdk-lib/aws-s3-deployment';
|
|
5
|
+
import * as common from '../../common';
|
|
6
|
+
import * as types from '../../types';
|
|
7
|
+
/**
|
|
8
|
+
* @stability stable
|
|
9
|
+
* @category cdk-utils.s3-manager
|
|
10
|
+
* @subcategory Construct
|
|
11
|
+
* @classdesc Provides operations on AWS S3.
|
|
12
|
+
* - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
|
|
13
|
+
* - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
|
|
14
|
+
* @example
|
|
15
|
+
* import * as common from '@gradientedge/cdk-utils'
|
|
16
|
+
*
|
|
17
|
+
* class CustomConstruct extends common.common.CommonConstruct {
|
|
18
|
+
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
19
|
+
* super(parent, id, props)
|
|
20
|
+
* this.props = props
|
|
21
|
+
* this.s3Manager.createS3Bucket('MyBucket', this)
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* @see [CDK S3 Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3-readme.html}
|
|
26
|
+
*/
|
|
27
|
+
export declare class S3Manager {
|
|
28
|
+
/**
|
|
29
|
+
* @summary Method to determine S3 Bucket lifecycle properties
|
|
30
|
+
* @param {types.S3BucketProps} props bucket properties
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
protected determineBucketLifecycleRules(props: types.S3BucketProps): types.LifecycleRule[] | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* @summary Method to determine the bucket name
|
|
36
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
37
|
+
* @param {types.S3BucketProps} props bucket properties
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
protected static determineBucketName(scope: common.CommonConstruct, props: types.S3BucketProps): string;
|
|
41
|
+
/**
|
|
42
|
+
* @summary Method to determine the log bucket name
|
|
43
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
44
|
+
* @param {types.S3BucketProps} props bucket properties
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
protected static determineLogBucketName(scope: common.CommonConstruct, props: types.S3BucketProps): string;
|
|
48
|
+
/**
|
|
49
|
+
* @summary Method to create a s3 bucket
|
|
50
|
+
* @param {string} id scoped id of the resource
|
|
51
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
52
|
+
* @param {types.S3BucketProps} props bucket properties
|
|
53
|
+
*/
|
|
54
|
+
createS3Bucket(id: string, scope: common.CommonConstruct, props: types.S3BucketProps): cdk.aws_s3.IBucket;
|
|
55
|
+
/**
|
|
56
|
+
* @summary Method to create an iam bucket policy for cloudtrail
|
|
57
|
+
* @param {string} id scoped id of the resource
|
|
58
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
59
|
+
* @param {s3.IBucket} bucket
|
|
60
|
+
*/
|
|
61
|
+
createBucketPolicyForCloudTrail(id: string, scope: common.CommonConstruct, bucket: s3.IBucket): cdk.aws_s3.CfnBucketPolicy;
|
|
62
|
+
/**
|
|
63
|
+
* @summary Method to create a s3 bucket deployment
|
|
64
|
+
* @param {string} id scoped id of the resource
|
|
65
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
66
|
+
* @param {s3.IBucket} siteBucket
|
|
67
|
+
* @param {cloudfront.IDistribution} distribution
|
|
68
|
+
* @param {s3deploy.ISource[]} sources
|
|
69
|
+
* @param {string} prefix
|
|
70
|
+
* @param {boolean} prune
|
|
71
|
+
*/
|
|
72
|
+
doBucketDeployment(id: string, scope: common.CommonConstruct, siteBucket: s3.IBucket, distribution: cloudfront.IDistribution, sources: s3deploy.ISource[], prefix: string, prune?: boolean): void;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=s3-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3-manager.d.ts","sourceRoot":"","sources":["../../../../../src/lib/manager/aws/s3-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAClC,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAA;AAExD,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACxC,OAAO,KAAK,QAAQ,MAAM,+BAA+B,CAAA;AACzD,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,KAAK,MAAM,aAAa,CAAA;AAGpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,SAAS;IACpB;;;;OAIG;IACH,SAAS,CAAC,6BAA6B,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa;IAyBlE;;;;;OAKG;IACH,SAAS,CAAC,MAAM,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,KAAK,CAAC,aAAa;IAM9F;;;;;OAKG;IACH,SAAS,CAAC,MAAM,CAAC,sBAAsB,CAAC,KAAK,EAAE,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,KAAK,CAAC,aAAa;IAMjG;;;;;OAKG;IACI,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,KAAK,CAAC,aAAa;IAkD3F;;;;;OAKG;IACI,+BAA+B,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,EAAE,EAAE,CAAC,OAAO;IA0BpG;;;;;;;;;OASG;IACI,kBAAkB,CACvB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,CAAC,eAAe,EAC7B,UAAU,EAAE,EAAE,CAAC,OAAO,EACtB,YAAY,EAAE,UAAU,CAAC,aAAa,EACtC,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,EAC3B,MAAM,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,OAAO;CAalB"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.S3Manager = void 0;
|
|
23
|
+
const cdk = __importStar(require("aws-cdk-lib"));
|
|
24
|
+
const iam = __importStar(require("aws-cdk-lib/aws-iam"));
|
|
25
|
+
const s3 = __importStar(require("aws-cdk-lib/aws-s3"));
|
|
26
|
+
const s3deploy = __importStar(require("aws-cdk-lib/aws-s3-deployment"));
|
|
27
|
+
const utils = __importStar(require("../../utils"));
|
|
28
|
+
/**
|
|
29
|
+
* @stability stable
|
|
30
|
+
* @category cdk-utils.s3-manager
|
|
31
|
+
* @subcategory Construct
|
|
32
|
+
* @classdesc Provides operations on AWS S3.
|
|
33
|
+
* - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
|
|
34
|
+
* - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
|
|
35
|
+
* @example
|
|
36
|
+
* import * as common from '@gradientedge/cdk-utils'
|
|
37
|
+
*
|
|
38
|
+
* class CustomConstruct extends common.common.CommonConstruct {
|
|
39
|
+
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
40
|
+
* super(parent, id, props)
|
|
41
|
+
* this.props = props
|
|
42
|
+
* this.s3Manager.createS3Bucket('MyBucket', this)
|
|
43
|
+
* }
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* @see [CDK S3 Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3-readme.html}
|
|
47
|
+
*/
|
|
48
|
+
class S3Manager {
|
|
49
|
+
/**
|
|
50
|
+
* @summary Method to determine S3 Bucket lifecycle properties
|
|
51
|
+
* @param {types.S3BucketProps} props bucket properties
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
determineBucketLifecycleRules(props) {
|
|
55
|
+
if (!props.lifecycleRules)
|
|
56
|
+
return undefined;
|
|
57
|
+
const bucketLifecycleRules = [];
|
|
58
|
+
props.lifecycleRules.forEach(lifecycleRule => {
|
|
59
|
+
bucketLifecycleRules.push({
|
|
60
|
+
id: lifecycleRule.id,
|
|
61
|
+
enabled: lifecycleRule.enabled,
|
|
62
|
+
abortIncompleteMultipartUploadAfter: lifecycleRule.abortIncompleteMultipartUploadAfter,
|
|
63
|
+
expirationDate: lifecycleRule.expirationDate,
|
|
64
|
+
expiration: lifecycleRule.expirationInDays ? cdk.Duration.days(lifecycleRule.expirationInDays) : undefined,
|
|
65
|
+
noncurrentVersionExpiration: lifecycleRule.noncurrentVersionExpirationInDays
|
|
66
|
+
? cdk.Duration.days(lifecycleRule.noncurrentVersionExpirationInDays)
|
|
67
|
+
: undefined,
|
|
68
|
+
noncurrentVersionTransitions: lifecycleRule.noncurrentVersionTransitions,
|
|
69
|
+
transitions: lifecycleRule.transitions,
|
|
70
|
+
prefix: lifecycleRule.prefix,
|
|
71
|
+
tagFilters: lifecycleRule.tagFilters,
|
|
72
|
+
expiredObjectDeleteMarker: lifecycleRule.expiredObjectDeleteMarker,
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
return bucketLifecycleRules;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @summary Method to determine the bucket name
|
|
79
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
80
|
+
* @param {types.S3BucketProps} props bucket properties
|
|
81
|
+
* @private
|
|
82
|
+
*/
|
|
83
|
+
static determineBucketName(scope, props) {
|
|
84
|
+
return scope.isProductionStage()
|
|
85
|
+
? `${props.bucketName}.${scope.fullyQualifiedDomainName}`
|
|
86
|
+
: `${props.bucketName}-${scope.props.stage}.${scope.fullyQualifiedDomainName}`;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @summary Method to determine the log bucket name
|
|
90
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
91
|
+
* @param {types.S3BucketProps} props bucket properties
|
|
92
|
+
* @private
|
|
93
|
+
*/
|
|
94
|
+
static determineLogBucketName(scope, props) {
|
|
95
|
+
return scope.isProductionStage()
|
|
96
|
+
? `${props.logBucketName}.${scope.fullyQualifiedDomainName}`
|
|
97
|
+
: `${props.logBucketName}-${scope.props.stage}.${scope.fullyQualifiedDomainName}`;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @summary Method to create a s3 bucket
|
|
101
|
+
* @param {string} id scoped id of the resource
|
|
102
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
103
|
+
* @param {types.S3BucketProps} props bucket properties
|
|
104
|
+
*/
|
|
105
|
+
createS3Bucket(id, scope, props) {
|
|
106
|
+
if (!props)
|
|
107
|
+
throw `S3 props undefined`;
|
|
108
|
+
let bucket;
|
|
109
|
+
const bucketName = S3Manager.determineBucketName(scope, props);
|
|
110
|
+
if (props.existingBucket && props.bucketName) {
|
|
111
|
+
bucket = s3.Bucket.fromBucketName(scope, `${id}`, bucketName);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
let logBucket;
|
|
115
|
+
if (props.logBucketName) {
|
|
116
|
+
const logBucketName = S3Manager.determineLogBucketName(scope, props);
|
|
117
|
+
logBucket = s3.Bucket.fromBucketName(scope, `${id}-logs`, logBucketName);
|
|
118
|
+
}
|
|
119
|
+
bucket = new s3.Bucket(scope, `${id}-bucket`, {
|
|
120
|
+
accessControl: props.accessControl,
|
|
121
|
+
autoDeleteObjects: props.autoDeleteObjects,
|
|
122
|
+
blockPublicAccess: props.blockPublicAccess || s3.BlockPublicAccess.BLOCK_ALL,
|
|
123
|
+
bucketName: bucketName,
|
|
124
|
+
cors: props.cors,
|
|
125
|
+
encryption: props.encryption || s3.BucketEncryption.S3_MANAGED,
|
|
126
|
+
encryptionKey: props.encryptionKey,
|
|
127
|
+
lifecycleRules: this.determineBucketLifecycleRules(props),
|
|
128
|
+
metrics: props.metrics,
|
|
129
|
+
publicReadAccess: props.publicReadAccess,
|
|
130
|
+
removalPolicy: props.removalPolicy || cdk.RemovalPolicy.RETAIN,
|
|
131
|
+
serverAccessLogsBucket: logBucket,
|
|
132
|
+
serverAccessLogsPrefix: props.serverAccessLogsPrefix,
|
|
133
|
+
websiteIndexDocument: props.websiteIndexDocument,
|
|
134
|
+
websiteErrorDocument: props.websiteErrorDocument,
|
|
135
|
+
websiteRoutingRules: props.websiteRoutingRules,
|
|
136
|
+
versioned: props.versioned,
|
|
137
|
+
});
|
|
138
|
+
const cfnBucket = bucket.node.defaultChild;
|
|
139
|
+
cfnBucket.notificationConfiguration = {
|
|
140
|
+
eventBridgeConfiguration: {
|
|
141
|
+
eventBridgeEnabled: props.enableEventBridge ?? false,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
utils.createCfnOutput(`${id}-bucketName`, scope, bucket.bucketName);
|
|
146
|
+
utils.createCfnOutput(`${id}-bucketArn`, scope, bucket.bucketArn);
|
|
147
|
+
return bucket;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* @summary Method to create an iam bucket policy for cloudtrail
|
|
151
|
+
* @param {string} id scoped id of the resource
|
|
152
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
153
|
+
* @param {s3.IBucket} bucket
|
|
154
|
+
*/
|
|
155
|
+
createBucketPolicyForCloudTrail(id, scope, bucket) {
|
|
156
|
+
const bucketPolicyDocument = new iam.PolicyDocument({
|
|
157
|
+
statements: [
|
|
158
|
+
new iam.PolicyStatement({
|
|
159
|
+
actions: ['s3:GetBucketAcl'],
|
|
160
|
+
effect: iam.Effect.ALLOW,
|
|
161
|
+
principals: [new iam.ServicePrincipal('cloudtrail.amazonaws.com')],
|
|
162
|
+
resources: [bucket.bucketArn],
|
|
163
|
+
sid: 'AWSCloudTrailAclCheck20150319',
|
|
164
|
+
}),
|
|
165
|
+
new iam.PolicyStatement({
|
|
166
|
+
actions: ['s3:PutObject'],
|
|
167
|
+
effect: iam.Effect.ALLOW,
|
|
168
|
+
principals: [new iam.ServicePrincipal('cloudtrail.amazonaws.com')],
|
|
169
|
+
resources: [bucket.arnForObjects('*')],
|
|
170
|
+
sid: 'AWSCloudTrailWrite20150319',
|
|
171
|
+
}),
|
|
172
|
+
],
|
|
173
|
+
});
|
|
174
|
+
return new s3.CfnBucketPolicy(scope, `${id}`, {
|
|
175
|
+
bucket: bucket.bucketName,
|
|
176
|
+
policyDocument: bucketPolicyDocument,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* @summary Method to create a s3 bucket deployment
|
|
181
|
+
* @param {string} id scoped id of the resource
|
|
182
|
+
* @param {common.CommonConstruct} scope scope in which this resource is defined
|
|
183
|
+
* @param {s3.IBucket} siteBucket
|
|
184
|
+
* @param {cloudfront.IDistribution} distribution
|
|
185
|
+
* @param {s3deploy.ISource[]} sources
|
|
186
|
+
* @param {string} prefix
|
|
187
|
+
* @param {boolean} prune
|
|
188
|
+
*/
|
|
189
|
+
doBucketDeployment(id, scope, siteBucket, distribution, sources, prefix, prune) {
|
|
190
|
+
new s3deploy.BucketDeployment(scope, `${id}`, {
|
|
191
|
+
destinationBucket: siteBucket,
|
|
192
|
+
destinationKeyPrefix: prefix,
|
|
193
|
+
distribution: distribution,
|
|
194
|
+
distributionPaths: ['/*'],
|
|
195
|
+
memoryLimit: 1024,
|
|
196
|
+
prune: !!prune,
|
|
197
|
+
serverSideEncryption: s3deploy.ServerSideEncryption.AES_256,
|
|
198
|
+
sources: sources,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
exports.S3Manager = S3Manager;
|
|
203
|
+
//# sourceMappingURL=s3-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3-manager.js","sourceRoot":"","sources":["../../../../../src/lib/manager/aws/s3-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAkC;AAElC,yDAA0C;AAC1C,uDAAwC;AACxC,wEAAyD;AAGzD,mDAAoC;AAEpC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,SAAS;IACpB;;;;OAIG;IACO,6BAA6B,CAAC,KAA0B;QAChE,IAAI,CAAC,KAAK,CAAC,cAAc;YAAE,OAAO,SAAS,CAAA;QAE3C,MAAM,oBAAoB,GAA0B,EAAE,CAAA;QACtD,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;YAC3C,oBAAoB,CAAC,IAAI,CAAC;gBACxB,EAAE,EAAE,aAAa,CAAC,EAAE;gBACpB,OAAO,EAAE,aAAa,CAAC,OAAO;gBAC9B,mCAAmC,EAAE,aAAa,CAAC,mCAAmC;gBACtF,cAAc,EAAE,aAAa,CAAC,cAAc;gBAC5C,UAAU,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS;gBAC1G,2BAA2B,EAAE,aAAa,CAAC,iCAAiC;oBAC1E,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,iCAAiC,CAAC;oBACpE,CAAC,CAA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AAK,EAAE,GAAG,EAAE,EAAE,EAAE;YAC5C,MAAM,EAAE,MAAM,CAAC,UAAU;YACzB,cAAc,EAAE,oBAAoB;SACrC,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;;;;OASG;IACI,kBAAkB,CACvB,EAAU,EACV,KAA6B,EAC7B,UAAsB,EACtB,YAAsC,EACtC,OAA2B,EAC3B,MAAc,EACd,KAAe;QAEf,IAAI,QAAQ,CAAC,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE;YAC5C,iBAAiB,EAAE,UAAU;YAC7B,oBAAoB,EAAE,MAAM;YAC5B,YAAY,EAAE,YAAY;YAC1B,iBAAiB,EAAE,CAAC,IAAI,CAAC;YACzB,WAAW,EAAE,IAAI;YACjB,KAAK,EAAE,CAAC,CAAC,KAAK;YACd,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB,CAAC,OAAO;YAC3D,OAAO,EAAE,OAAO;SACjB,CAAC,CAAA;IACJ,CAAC;CACF;AA7KD,8BA6KC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as cdk from 'aws-cdk-lib';
|
|
2
|
+
import * as common from '../../common';
|
|
3
|
+
/**
|
|
4
|
+
* @stability experimental
|
|
5
|
+
* @category cdk-utils.secrets-manager
|
|
6
|
+
* @subcategory Construct
|
|
7
|
+
* @classdesc Provides operations on AWS Secrets Manager.
|
|
8
|
+
* - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
|
|
9
|
+
* - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
|
|
10
|
+
* @example
|
|
11
|
+
* import * as common from '@gradientedge/cdk-utils'
|
|
12
|
+
*
|
|
13
|
+
* class CustomConstruct extends common.common.CommonConstruct {
|
|
14
|
+
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
15
|
+
* super(parent, id, props)
|
|
16
|
+
* this.props = props
|
|
17
|
+
* this.secretsManager.loadSecret('MySecretName', 'eu-west-1')
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* @see [CDK Secrets Manager Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager-readme.html}
|
|
22
|
+
*/
|
|
23
|
+
export declare class SecretsManager {
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param {string} region
|
|
27
|
+
*/
|
|
28
|
+
getAwsSecretsManager(region: string): any;
|
|
29
|
+
/**
|
|
30
|
+
* @stability experimental
|
|
31
|
+
* @summary Method to load a secret from secrets manager
|
|
32
|
+
* @param {string} secretName
|
|
33
|
+
* @param {string} region
|
|
34
|
+
*/
|
|
35
|
+
loadSecret(secretName: string, region: string): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* @stability experimental
|
|
38
|
+
* @summary Method to load secrets from secrets manager
|
|
39
|
+
* @param {string} secretNames
|
|
40
|
+
* @param {string} region
|
|
41
|
+
*/
|
|
42
|
+
loadSecrets(secretNames: string, region: string): Promise<{}>;
|
|
43
|
+
/**
|
|
44
|
+
* @stability experimental
|
|
45
|
+
* @summary Method to export secrets from secrets manager to a dot env format
|
|
46
|
+
*/
|
|
47
|
+
exportToDotEnv(): void;
|
|
48
|
+
/**
|
|
49
|
+
* @stability stable
|
|
50
|
+
* @summary Method to retrieve a secret from secrets manager with a cloudformation export
|
|
51
|
+
* @param id
|
|
52
|
+
* @param scope
|
|
53
|
+
* @param stackName
|
|
54
|
+
* @param exportName
|
|
55
|
+
*/
|
|
56
|
+
retrieveSecretFromSecretsManager(id: string, scope: common.CommonConstruct, stackName: string, exportName: string): cdk.aws_secretsmanager.ISecret;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=secrets-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-manager.d.ts","sourceRoot":"","sources":["../../../../../src/lib/manager/aws/secrets-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,aAAa,CAAA;AAElC,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AAKtC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,cAAc;IACzB;;;OAGG;IACI,oBAAoB,CAAC,MAAM,EAAE,MAAM;IAI1C;;;;;OAKG;IACU,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAO1D;;;;;OAKG;IACU,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAS5D;;;OAGG;IACI,cAAc;IA2BrB;;;;;;;OAOG;IACI,gCAAgC,CACrC,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,CAAC,eAAe,EAC7B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM;CAQrB"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.SecretsManager = void 0;
|
|
23
|
+
const cdk = __importStar(require("aws-cdk-lib"));
|
|
24
|
+
const secretsManager = __importStar(require("aws-cdk-lib/aws-secretsmanager"));
|
|
25
|
+
const AWS = require('aws-sdk');
|
|
26
|
+
const fs = require('fs');
|
|
27
|
+
/**
|
|
28
|
+
* @stability experimental
|
|
29
|
+
* @category cdk-utils.secrets-manager
|
|
30
|
+
* @subcategory Construct
|
|
31
|
+
* @classdesc Provides operations on AWS Secrets Manager.
|
|
32
|
+
* - A new instance of this class is injected into {@link common.CommonConstruct} constructor.
|
|
33
|
+
* - If a custom construct extends {@link common.CommonConstruct}, an instance is available within the context.
|
|
34
|
+
* @example
|
|
35
|
+
* import * as common from '@gradientedge/cdk-utils'
|
|
36
|
+
*
|
|
37
|
+
* class CustomConstruct extends common.common.CommonConstruct {
|
|
38
|
+
* constructor(parent: cdk.Construct, id: string, props: common.CommonStackProps) {
|
|
39
|
+
* super(parent, id, props)
|
|
40
|
+
* this.props = props
|
|
41
|
+
* this.secretsManager.loadSecret('MySecretName', 'eu-west-1')
|
|
42
|
+
* }
|
|
43
|
+
* }
|
|
44
|
+
*
|
|
45
|
+
* @see [CDK Secrets Manager Module]{@link https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager-readme.html}
|
|
46
|
+
*/
|
|
47
|
+
class SecretsManager {
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param {string} region
|
|
51
|
+
*/
|
|
52
|
+
getAwsSecretsManager(region) {
|
|
53
|
+
return new AWS.SecretsManager({ region: region });
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @stability experimental
|
|
57
|
+
* @summary Method to load a secret from secrets manager
|
|
58
|
+
* @param {string} secretName
|
|
59
|
+
* @param {string} region
|
|
60
|
+
*/
|
|
61
|
+
async loadSecret(secretName, region) {
|
|
62
|
+
const secretsManager = this.getAwsSecretsManager(region);
|
|
63
|
+
const secret = await Promise.all([secretsManager.getSecretValue({ SecretId: secretName }).promise()]);
|
|
64
|
+
return secret ? JSON.parse(secret[0].SecretString) : {};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @stability experimental
|
|
68
|
+
* @summary Method to load secrets from secrets manager
|
|
69
|
+
* @param {string} secretNames
|
|
70
|
+
* @param {string} region
|
|
71
|
+
*/
|
|
72
|
+
async loadSecrets(secretNames, region) {
|
|
73
|
+
let secrets = {};
|
|
74
|
+
for (const secretName of secretNames.split(',')) {
|
|
75
|
+
secrets = { ...secrets, ...(await this.loadSecret(secretName, region)) };
|
|
76
|
+
}
|
|
77
|
+
return secrets;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @stability experimental
|
|
81
|
+
* @summary Method to export secrets from secrets manager to a dot env format
|
|
82
|
+
*/
|
|
83
|
+
exportToDotEnv() {
|
|
84
|
+
let nconf = require('nconf');
|
|
85
|
+
nconf.argv().env();
|
|
86
|
+
const appRoot = require('app-root-path');
|
|
87
|
+
if (nconf.get('profile')) {
|
|
88
|
+
console.log(`Using named aws profile ${nconf.get('profile')}`);
|
|
89
|
+
AWS.config.credentials = new AWS.SharedIniFileCredentials({ profile: nconf.get('profile') });
|
|
90
|
+
}
|
|
91
|
+
const region = nconf.get('region');
|
|
92
|
+
AWS.config.update({ region: nconf.get('region') });
|
|
93
|
+
const outFileName = nconf.get('out') ? nconf.get('out') : '.env';
|
|
94
|
+
this.loadSecret(nconf.get('name'), region).then((secretString) => {
|
|
95
|
+
if (nconf.get('overwrite')) {
|
|
96
|
+
fs.writeFileSync(`${appRoot.path}/.env`, '');
|
|
97
|
+
}
|
|
98
|
+
Object.keys(secretString).forEach(function (key) {
|
|
99
|
+
console.log(`Adding environment variable for key: ${key}`);
|
|
100
|
+
fs.appendFileSync(`${appRoot.path}/${outFileName}`, `${key}=${secretString[key]}\r\n`);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* @stability stable
|
|
106
|
+
* @summary Method to retrieve a secret from secrets manager with a cloudformation export
|
|
107
|
+
* @param id
|
|
108
|
+
* @param scope
|
|
109
|
+
* @param stackName
|
|
110
|
+
* @param exportName
|
|
111
|
+
*/
|
|
112
|
+
retrieveSecretFromSecretsManager(id, scope, stackName, exportName) {
|
|
113
|
+
return secretsManager.Secret.fromSecretNameV2(scope, `${id}`, cdk.Fn.importValue(`${stackName}-${scope.props.stage}-${exportName}`));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.SecretsManager = SecretsManager;
|
|
117
|
+
//# sourceMappingURL=secrets-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets-manager.js","sourceRoot":"","sources":["../../../../../src/lib/manager/aws/secrets-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAkC;AAClC,+EAAgE;AAGhE,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAA;AAC9B,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAExB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,cAAc;IACzB;;;OAGG;IACI,oBAAoB,CAAC,MAAc;QACxC,OAAO,IAAI,GAAG,CAAC,cAAc,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IACnD,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,UAAU,CAAC,UAAkB,EAAE,MAAc;QACxD,MAAM,cAAc,GAAG,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAA;QACxD,MAAM,MAAM,GAAQ,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;QAE1G,OAAO,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAA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